Reference,
depending on the current "strength" when getInstance() was called.
The value is conceptually immutable. If it is held via a direct reference, then it is actually immutable.
A Reference may be cleared (garbage-collected),
after which get() returns null.
It can then be reset via resetIfAbsent().
The new value should be the same as, or equivalent to, the old value.
Null values are supported. They can be distinguished from cleared values
via isNull().
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| public static enum | CacheValue.Strength
"Strength" of holding a value in CacheValue instances. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final CacheValue | |
| private static volatile CacheValue. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | |
| public abstract V | get()
Returns the value (which can be null), or null if it was held in a Reference and has been cleared. |
| public static <V> CacheValue | |
| public boolean | Returns: true if this object represents a null value.Distinguishes a null value from a Reference value that has been cleared. |
| public abstract V | Returns: The old or new value.Replacement value, for when the current value)Reference has been cleared.If the value was held via a |
| public static void | setStrength(CacheValue.
Changes the "strength" of value references for subsequent |
| NULL_VALUE | back to summary |
|---|---|
private static final CacheValue<V> NULL_VALUE
| |
| strength | back to summary |
|---|---|
| private static volatile CacheValue. | |
| CacheValue | back to summary |
|---|---|
| public CacheValue() | |
| futureInstancesWillBeStrong | back to summary |
|---|---|
| public static boolean futureInstancesWillBeStrong() Returns true if the "strength" is set to | |
| get | back to summary |
|---|---|
| public abstract V get() Returns the value (which can be null), or null if it was held in a Reference and has been cleared. | |
| getInstance | back to summary |
|---|---|
| public static <V> CacheValue Returns a CacheValue instance that holds the value.
It holds it directly if the value is null or if the current "strength" is
| |
| isNull | back to summary |
|---|---|
| public boolean isNull() Distinguishes a null value from a Reference value that has been cleared.
| |
| resetIfCleared | back to summary |
|---|---|
| public abstract V resetIfCleared(V value) If the value was held via a Otherwise the old value is returned.
| |
| setStrength | back to summary |
|---|---|
| public static void setStrength(CacheValue. Changes the "strength" of value references for subsequent | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public V | get()
Implements abstract com. |
| public boolean | isNull()
Overrides com. |
| public V | resetIfCleared(V
Replacement value, for when the current value)Reference has been cleared.Implements abstract com. Reference which has been cleared,
then it is replaced with a new Reference to the new value,
and the new value is returned.
|
| NullValue | back to summary |
|---|---|
| private NullValue() | |
| get | back to summary |
|---|---|
| public V get() Implements abstract com. Doc from com. Returns the value (which can be null), or null if it was held in a Reference and has been cleared.
| |
| isNull | back to summary |
|---|---|
| public boolean isNull() Overrides com. Doc from com. Distinguishes a null value from a Reference value that has been cleared.
| |
| resetIfCleared | back to summary |
|---|---|
| public V resetIfCleared(V value) Implements abstract com. Doc from com. If the value was held via a Otherwise the old value is returned. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public V | get()
Implements abstract com. |
| public synchronized V | resetIfCleared(V
Replacement value, for when the current value)Reference has been cleared.Implements abstract com. Reference which has been cleared,
then it is replaced with a new Reference to the new value,
and the new value is returned.
|
| ref | back to summary |
|---|---|
| private volatile Reference<V> ref | |
| SoftValue | back to summary |
|---|---|
| pack-priv SoftValue(V value) | |
| get | back to summary |
|---|---|
| public V get() Implements abstract com. Doc from com. Returns the value (which can be null), or null if it was held in a Reference and has been cleared.
| |
| resetIfCleared | back to summary |
|---|---|
| public synchronized V resetIfCleared(V value) Implements abstract com. Doc from com. If the value was held via a Otherwise the old value is returned. | |
SOFT.
| Modifier and Type | Field and Description |
|---|---|
| public static final CacheValue. | SOFT
Subsequent |
| public static final CacheValue. | STRONG
Subsequent |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static CacheValue. | |
| public static CacheValue. |
| SOFT | back to summary |
|---|---|
| public static final CacheValue. Subsequent | |
| STRONG | back to summary |
|---|---|
| public static final CacheValue. Subsequent | |
| Strength | back to summary |
|---|---|
| private Strength() | |
| valueOf | back to summary |
|---|---|
| public static CacheValue. | |
| values | back to summary |
|---|---|
| public static CacheValue. | |
| Modifier and Type | Field and Description |
|---|---|
| private V |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public V | get()
Implements abstract com. |
| public V | resetIfCleared(V
Replacement value, for when the current value)Reference has been cleared.Implements abstract com. Reference which has been cleared,
then it is replaced with a new Reference to the new value,
and the new value is returned.
|
| value | back to summary |
|---|---|
| private V value | |
| StrongValue | back to summary |
|---|---|
| pack-priv StrongValue(V value) | |
| get | back to summary |
|---|---|
| public V get() Implements abstract com. Doc from com. Returns the value (which can be null), or null if it was held in a Reference and has been cleared.
| |
| resetIfCleared | back to summary |
|---|---|
| public V resetIfCleared(V value) Implements abstract com. Doc from com. If the value was held via a Otherwise the old value is returned. | |