Class References.LookupKeyReference<E>
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.References.LookupKeyReference<E>
-
- All Implemented Interfaces:
References.InternalReference<E>
- Enclosing class:
- References
static final class References.LookupKeyReference<E> extends java.lang.Object implements References.InternalReference<E>
A short-lived adapter used for looking up an entry in the cache where the keys are weakly held. This References.InternalReference implementation is not suitable for storing in the cache as the key is strongly held.
-
-
Constructor Summary
Constructors Constructor Description LookupKeyReference(@NonNull E e)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object object)Eget()Returns this reference object's referent.java.lang.ObjectgetKeyReference()Returns the key that is associated to the cache entry holding this reference.inthashCode()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.benmanes.caffeine.cache.References.InternalReference
referenceEquals
-
-
-
-
Field Detail
-
hashCode
private final int hashCode
-
e
private final E e
-
-
Constructor Detail
-
LookupKeyReference
public LookupKeyReference(@NonNull E e)
-
-
Method Detail
-
get
public E get()
Description copied from interface:References.InternalReferenceReturns this reference object's referent. If this reference object has been cleared, either by the program or by the garbage collector, then this method returnsnull.- Specified by:
getin interfaceReferences.InternalReference<E>- Returns:
- The object to which this reference refers, or
nullif this reference object has been cleared
-
getKeyReference
public java.lang.Object getKeyReference()
Description copied from interface:References.InternalReferenceReturns the key that is associated to the cache entry holding this reference. If the cache holds keys strongly, this is that key instance. Otherwise the cache holds keys weakly and theReferences.WeakKeyReferenceis returned.- Specified by:
getKeyReferencein interfaceReferences.InternalReference<E>- Returns:
- the key that is associated to the cached entry
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-