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 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.
  • Field Details

    • hashCode

      private final int hashCode
    • e

      private final E e
  • Constructor Details

    • LookupKeyReference

      public LookupKeyReference(@Nonnull E e)
  • Method Details

    • 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 returns null.
      Specified by:
      get in interface References.InternalReference<E>
      Returns:
      The object to which this reference refers, or null if this reference object has been cleared
    • getKeyReference

      public 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 the References.WeakKeyReference is returned.
      Specified by:
      getKeyReference in interface References.InternalReference<E>
      Returns:
      the key that is associated to the cached entry
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object