Package org.apache.xbean.propertyeditor
Class ReferenceIdentityMap.ReferenceEntry
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.WeakReference
-
- org.apache.xbean.propertyeditor.ReferenceIdentityMap.ReferenceEntry
-
- Enclosing class:
- ReferenceIdentityMap
private static class ReferenceIdentityMap.ReferenceEntry extends java.lang.ref.WeakReference
Each entry in the Map is represented with a ReferenceEntry.If getKey() or getValue() returns null, it means the mapping is stale and should be removed.
- Since:
- Commons Collections 3.1
-
-
Field Summary
Fields Modifier and Type Field Description private int
hashCode
The hash code of the keyprivate ReferenceIdentityMap.ReferenceEntry
next
The next entry in the hash chainprivate java.lang.Object
value
The value
-
Constructor Summary
Constructors Modifier Constructor Description private
ReferenceEntry(ReferenceIdentityMap parent, ReferenceIdentityMap.ReferenceEntry next, int hashCode, java.lang.Object key, java.lang.Object value)
Creates a new entry object for the ReferenceMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.Object
getKey()
Gets the key from the entry.private java.lang.Object
getValue()
Gets the value from the entry.private void
purged()
Purges this entry.private java.lang.Object
setValue(java.lang.Object obj)
Sets the value of the entry.
-
-
-
Field Detail
-
next
private ReferenceIdentityMap.ReferenceEntry next
The next entry in the hash chain
-
hashCode
private int hashCode
The hash code of the key
-
value
private java.lang.Object value
The value
-
-
Constructor Detail
-
ReferenceEntry
private ReferenceEntry(ReferenceIdentityMap parent, ReferenceIdentityMap.ReferenceEntry next, int hashCode, java.lang.Object key, java.lang.Object value)
Creates a new entry object for the ReferenceMap.- Parameters:
parent
- the parent mapnext
- the next entry in the hash buckethashCode
- the hash code of the keykey
- the keyvalue
- the value
-
-
Method Detail
-
getKey
private java.lang.Object getKey()
Gets the key from the entry. This method dereferences weak and soft keys and thus may return null.- Returns:
- the key, which may be null if it was garbage collected
-
getValue
private java.lang.Object getValue()
Gets the value from the entry. This method dereferences weak and soft value and thus may return null.- Returns:
- the value, which may be null if it was garbage collected
-
setValue
private java.lang.Object setValue(java.lang.Object obj)
Sets the value of the entry.- Parameters:
obj
- the object to store- Returns:
- the previous value
-
purged
private void purged()
Purges this entry.
-
-