Skip navigation links
org.graalvm.shadowed.com.ibm.icu.impl

Class CacheValue<V>

    • Constructor Detail

      • CacheValue

        public CacheValue()
    • Method Detail

      • setStrength

        public static void setStrength(CacheValue.Strength strength)
        Changes the "strength" of value references for subsequent getInstance() calls.
      • futureInstancesWillBeStrong

        public static boolean futureInstancesWillBeStrong()
        Returns true if the "strength" is set to STRONG.
      • getInstance

        public static <V> CacheValue<V> getInstance(V value)
        Returns a CacheValue instance that holds the value. It holds it directly if the value is null or if the current "strength" is STRONG. Otherwise, it holds it via a Reference.
      • isNull

        public boolean isNull()
        Distinguishes a null value from a Reference value that has been cleared.
        Returns:
        true if this object represents a null value.
      • get

        public abstract V get()
        Returns the value (which can be null), or null if it was held in a Reference and has been cleared.
      • resetIfCleared

        public abstract 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. The old and new values should be the same or equivalent.

        Otherwise the old value is returned.

        Parameters:
        value - Replacement value, for when the current Reference has been cleared.
        Returns:
        The old or new value.