Class ReferenceIdentityMap.ReferenceEntry

java.lang.Object
java.lang.ref.Reference
java.lang.ref.WeakReference
org.apache.xbean.propertyeditor.ReferenceIdentityMap.ReferenceEntry
Enclosing class:
ReferenceIdentityMap

private static class ReferenceIdentityMap.ReferenceEntry extends 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 Details

  • Constructor Details

    • ReferenceEntry

      private ReferenceEntry(ReferenceIdentityMap parent, ReferenceIdentityMap.ReferenceEntry next, int hashCode, Object key, Object value)
      Creates a new entry object for the ReferenceMap.
      Parameters:
      parent - the parent map
      next - the next entry in the hash bucket
      hashCode - the hash code of the key
      key - the key
      value - the value
  • Method Details

    • getKey

      private 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 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 Object setValue(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.