Class SoftValueRef<K,​V>

  • Type Parameters:
    K - the key type
    V - the value type
    All Implemented Interfaces:
    java.util.Map.Entry<K,​V>, ValueRef<K,​V>

    class SoftValueRef<K,​V>
    extends java.lang.ref.SoftReference<V>
    implements ValueRef<K,​V>
    Soft value ref.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      K key
      The key
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SoftValueRef​(K key, V val, java.lang.ref.ReferenceQueue<V> q)
      Create a new SoftValueRef.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static <K,​V>
      SoftValueRef<K,​V>
      create​(K key, V val, java.lang.ref.ReferenceQueue<V> q)
      Safely create a new SoftValueRef
      K getKey()  
      V getValue()  
      V setValue​(V value)  
      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
      • Methods inherited from interface java.util.Map.Entry

        equals, hashCode
      • Methods inherited from interface org.jboss.util.collection.ValueRef

        get
    • Field Detail

      • key

        public K key
        The key
    • Constructor Detail

      • SoftValueRef

        private SoftValueRef​(K key,
                             V val,
                             java.lang.ref.ReferenceQueue<V> q)
        Create a new SoftValueRef.
        Parameters:
        key - the key
        val - the value
        q - the reference queue
    • Method Detail

      • create

        static <K,​V> SoftValueRef<K,​V> create​(K key,
                                                          V val,
                                                          java.lang.ref.ReferenceQueue<V> q)
        Safely create a new SoftValueRef
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        key - the key
        val - the value
        q - the reference queue
        Returns:
        the reference or null if the value is null
      • getKey

        public K getKey()
        Specified by:
        getKey in interface java.util.Map.Entry<K,​V>
      • getValue

        public V getValue()
        Specified by:
        getValue in interface java.util.Map.Entry<K,​V>
      • setValue

        public V setValue​(V value)
        Specified by:
        setValue in interface java.util.Map.Entry<K,​V>
      • toString

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