|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.tables.WeakValue
Used to implement a key in a WeakValueMap implementation by being a value in a FlexMap.
Holds on to the actual value weakly. Is an HONORARY Selfless object, so it compares based on its equals() and hashCode() methods. A WeakValue is also a Runnable, since it stores itself as the reactor to be informed when its value is collected.
WeakValue's implementation of equals and hashCode does not satisfy the contract specified for HONORARY Selfless objects, but that's ok since the WeakValue class is only used in the implementation of WeakValueMap.
Field Summary | |
private Object |
myKey
So I can remove the association that maps to me. |
private FlexMap |
myOptMap
the map I'm in, that I need to remove myself from |
private WeakPtr |
myWeakPtr
weakly holds the actual value |
Constructor Summary | |
(package private) |
WeakValue(Object key,
Object value,
FlexMap map)
|
Method Summary | |
(package private) Object |
getOptActual()
If the actual value is still around, return it; else null. |
void |
run()
Invoked sometime after the actual value has been gced. |
String |
toString()
Suppressed: Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private final Object myKey
private final WeakPtr myWeakPtr
private FlexMap myOptMap
Constructor Detail |
WeakValue(Object key, Object value, FlexMap map)
Method Detail |
public void run()
run
in interface Runnable
java.lang.Thread#run()
Object getOptActual()
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |