Class AbstractReferenceMap.ReferenceEntry<K,V> 
java.lang.Object
org.apache.commons.collections4.map.AbstractHashedMap.HashEntry<K,V>
 
org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceEntry<K,V> 
- Type Parameters:
- K- the type of the keys
- V- the type of the values
- Enclosing class:
- AbstractReferenceMap<K,- V> 
protected static class AbstractReferenceMap.ReferenceEntry<K,V> 
extends AbstractHashedMap.HashEntry<K,V> 
A MapEntry implementation for the map.
 
If getKey() or getValue() returns null, it means the mapping is stale and should be removed.
- Since:
- 3.1
- 
Field SummaryFields inherited from class org.apache.commons.collections4.map.AbstractHashedMap.HashEntryhashCode, key, next, value
- 
Constructor SummaryConstructorsConstructorDescriptionReferenceEntry(AbstractReferenceMap<K, V> parent, AbstractHashedMap.HashEntry<K, V> next, int hashCode, K key, V value) Creates a new entry object for the ReferenceMap.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanCompares this map entry to another.getKey()Gets the key from the entry.getValue()Gets the value from the entry.inthashCode()Gets the hash code of the entry using temporary hard references.protected AbstractReferenceMap.ReferenceEntry<K, V> next()Gets the next entry in the bucket.protected voidThis method can be overridden to provide custom logic to purge valueprotected voidonPurge()This is the callback for custom "after purge" logicprotected booleanPurges the specified referenceSets the value of the entry.protected <T> ObjecttoReference(AbstractReferenceMap.ReferenceStrength type, T referent, int hash) Constructs a reference of the given type to the given referent.Methods inherited from class org.apache.commons.collections4.map.AbstractHashedMap.HashEntrytoString
- 
Constructor Details- 
ReferenceEntrypublic ReferenceEntry(AbstractReferenceMap<K, V> parent, AbstractHashedMap.HashEntry<K, V> next, int hashCode, K key, V 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- 
equalsCompares this map entry to another.This implementation uses isEqualKeyandisEqualValueon the main map for comparison.
- 
getKeyGets the key from the entry. This method dereferences weak and soft keys and thus may return null.
- 
getValueGets the value from the entry. This method dereferences weak and soft value and thus may return null.
- 
hashCode
- 
nextGets the next entry in the bucket.- Returns:
- the next entry in the bucket
 
- 
nullValueThis method can be overridden to provide custom logic to purge value
- 
onPurgeThis is the callback for custom "after purge" logic
- 
purge
- 
setValue
- 
toReferenceConstructs a reference of the given type to the given referent. The reference is registered with the queue for later purging.- Type Parameters:
- T- the type of the referenced object
- Parameters:
- type- HARD, SOFT or WEAK
- referent- the object to refer to
- hash- the hash code of the key of the mapping; this number might be different from referent.hashCode() if the referent represents a value and not a key
- Returns:
- the reference to the object
 
 
-