Class SoftReference<T,​A>

  • Type Parameters:
    T - the reference value type
    A - the attachment type
    All Implemented Interfaces:
    Reference<T,​A>

    public class SoftReference<T,​A>
    extends java.lang.ref.SoftReference<T>
    implements Reference<T,​A>
    A reapable soft reference with an attachment. If a Reaper is given, then it will be used to asynchronously clean up the referent.
    Author:
    David M. Lloyd
    See Also:
    SoftReference
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      A getAttachment()
      Get the attachment, if any.
      Reaper<T,​A> getReaper()  
      Reference.Type getType()
      Get the type of the reference.
      java.lang.String toString()  
      • Methods inherited from class java.lang.ref.SoftReference

        get
      • Methods inherited from class java.lang.ref.Reference

        clear, clone, enqueue, isEnqueued, reachabilityFence
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SoftReference

        public SoftReference​(T referent)
      • SoftReference

        public SoftReference​(T referent,
                             A attachment)
      • SoftReference

        public SoftReference​(T referent,
                             A attachment,
                             java.lang.ref.ReferenceQueue<? super T> q)
      • SoftReference

        public SoftReference​(T referent,
                             A attachment,
                             Reaper<T,​A> reaper)
    • Method Detail

      • getReaper

        public Reaper<T,​A> getReaper()
      • getAttachment

        public A getAttachment()
        Description copied from interface: Reference
        Get the attachment, if any.
        Specified by:
        getAttachment in interface Reference<T,​A>
        Returns:
        the attachment
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object