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(E e)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
E
get()
Returns this reference object's referent.java.lang.Object
getKeyReference()
Returns the key that is associated to the cache entry holding this reference.int
hashCode()
-
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.InternalReference
Returns 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:
get
in interfaceReferences.InternalReference<E>
- Returns:
- The object to which this reference refers, or
null
if this reference object has been cleared
-
getKeyReference
public java.lang.Object getKeyReference()
Description copied from interface:References.InternalReference
Returns 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.WeakKeyReference
is returned.- Specified by:
getKeyReference
in interfaceReferences.InternalReference<E>
- Returns:
- the key that is associated to the cached entry
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-