Cache implementations that need to adapt
null values (and potentially other such special values) before
passing them on to the underlying store.
Transparently replaces given null user values with an internal
NullValue#INSTANCE, if configured to support null values
(as indicated by isAllowNullValues()).
| Modifier and Type | Field and Description |
|---|---|
| private final boolean |
| Access | Constructor and Description |
|---|---|
| protected | AbstractValueAdaptingCache(boolean
whether to allow for allowNullValues)null valuesCreate an |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | Returns: the value to return to the userthe store value storeValue)Convert the given value from the internal store to a user value
returned from the get method (adapting |
| public Cache. | get(Object
the key whose associated value is to be returned key)Implements org. Return the value to which this cache maps the specified key. |
| public <T> T | get(Object
the key whose associated value is to be returned key, Class<T> the required type of the returned value (may be
type)null to bypass a type check; in case of a null
value found in the cache, the specified type is irrelevant)Implements org. Return the value to which this cache maps the specified key, generically specifying a type that return value will be cast to. |
| public final boolean | |
| protected abstract Object | |
| protected Object | Returns: the value to storethe given user value userValue)Convert the given user value, as passed into the put method,
to a value in the internal store (adapting |
| protected Cache. | Returns: the wrapped valuethe original value storeValue)Wrap the given store value with a |
| allowNullValues | back to summary |
|---|---|
| private final boolean allowNullValues | |
| AbstractValueAdaptingCache | back to summary |
|---|---|
| protected AbstractValueAdaptingCache(boolean allowNullValues) Create an
| |
| fromStoreValue | back to summary |
|---|---|
| protected Object fromStoreValue(Object storeValue) Convert the given value from the internal store to a user value
returned from the get method (adapting | |
| get | back to summary |
|---|---|
| public Cache. Implements org. Doc from org. Return the value to which this cache maps the specified key. Returns
| |
| get | back to summary |
|---|---|
| public <T> T get(Object key, Class<T> type) Implements org. Doc from org. Return the value to which this cache maps the specified key, generically specifying a type that return value will be cast to. Note This variant of
| |
| isAllowNullValues | back to summary |
|---|---|
| public final boolean isAllowNullValues() Return whether | |
| lookup | back to summary |
|---|---|
| protected abstract Object lookup(Object key) Perform an actual lookup in the underlying store. | |
| toStoreValue | back to summary |
|---|---|
| protected Object toStoreValue(Object userValue) Convert the given user value, as passed into the put method,
to a value in the internal store (adapting | |
| toValueWrapper | back to summary |
|---|---|
| protected Cache. Wrap the given store value with a
| |