Class CacheValue.StrongValue<V>

  • Enclosing class:
    CacheValue<V>

    private static final class CacheValue.StrongValue<V>
    extends CacheValue<V>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private V value  
    • Constructor Summary

      Constructors 
      Constructor Description
      StrongValue​(V value)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V get()
      Returns the value (which can be null), or null if it was held in a Reference and has been cleared.
      V resetIfCleared​(V value)
      If the value was held via a Reference which has been cleared, then it is replaced with a new Reference to the new value, and the new value is returned.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • value

        private V value
    • Constructor Detail

      • StrongValue

        StrongValue​(V value)
    • Method Detail

      • get

        public V get()
        Description copied from class: CacheValue
        Returns the value (which can be null), or null if it was held in a Reference and has been cleared.
        Specified by:
        get in class CacheValue<V>
      • resetIfCleared

        public V resetIfCleared​(V value)
        Description copied from class: CacheValue
        If the value was held via a Reference which has been cleared, then it is replaced with a new Reference to the new value, and the new value is returned. The old and new values should be the same or equivalent.

        Otherwise the old value is returned.

        Specified by:
        resetIfCleared in class CacheValue<V>
        Parameters:
        value - Replacement value, for when the current Reference has been cleared.
        Returns:
        The old or new value.