@API(value=Internal) public class NamespaceAwareStore extends java.lang.Object implements ExtensionContext.Store
| Constructor and Description |
|---|
NamespaceAwareStore(ExtensionValuesStore valuesStore,
ExtensionContext.Namespace namespace) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
get(java.lang.Object key)
Get the value that is stored under the supplied
key. |
<T> T |
get(java.lang.Object key,
java.lang.Class<T> requiredType)
Get the value of the specified required type that is stored under
the supplied
key. |
<K,V> java.lang.Object |
getOrComputeIfAbsent(K key,
java.util.function.Function<K,V> defaultCreator)
Get the value that is stored under the supplied
key. |
<K,V> V |
getOrComputeIfAbsent(K key,
java.util.function.Function<K,V> defaultCreator,
java.lang.Class<V> requiredType)
Get the value of the specified required type that is stored under the
supplied
key. |
void |
put(java.lang.Object key,
java.lang.Object value)
Store a
value for later retrieval under the supplied key. |
java.lang.Object |
remove(java.lang.Object key)
Remove the value that was previously stored under the supplied
key. |
<T> T |
remove(java.lang.Object key,
java.lang.Class<T> requiredType)
Remove the value of the specified required type that was previously stored
under the supplied
key. |
public NamespaceAwareStore(ExtensionValuesStore valuesStore, ExtensionContext.Namespace namespace)
public java.lang.Object get(java.lang.Object key)
ExtensionContext.Storekey.
If no value is stored in the current ExtensionContext
for the supplied key, ancestors of the context will be queried
for a value with the same key in the Namespace used
to create this store.
For greater type safety, consider using ExtensionContext.Store.get(Object, Class)
instead.
get in interface ExtensionContext.Storekey - the key; never nullnullExtensionContext.Store.get(Object, Class)public <T> T get(java.lang.Object key,
java.lang.Class<T> requiredType)
ExtensionContext.Storekey.
If no value is stored in the current ExtensionContext
for the supplied key, ancestors of the context will be queried
for a value with the same key in the Namespace used
to create this store.
get in interface ExtensionContext.StoreT - the value typekey - the key; never nullrequiredType - the required type of the value; never nullnullExtensionContext.Store.get(Object)public <K,V> java.lang.Object getOrComputeIfAbsent(K key,
java.util.function.Function<K,V> defaultCreator)
ExtensionContext.Storekey.
If no value is stored in the current ExtensionContext
for the supplied key, ancestors of the context will be queried
for a value with the same key in the Namespace used
to create this store. If no value is found for the supplied key,
a new value will be computed by the defaultCreator (given
the key as input), stored, and returned.
For greater type safety, consider using
ExtensionContext.Store.getOrComputeIfAbsent(Object, Function, Class) instead.
getOrComputeIfAbsent in interface ExtensionContext.StoreK - the key typeV - the value typekey - the key; never nulldefaultCreator - the function called with the supplied key
to create a new value; never nullnullExtensionContext.Store.getOrComputeIfAbsent(Object, Function, Class)public <K,V> V getOrComputeIfAbsent(K key,
java.util.function.Function<K,V> defaultCreator,
java.lang.Class<V> requiredType)
ExtensionContext.Storekey.
If no value is stored in the current ExtensionContext
for the supplied key, ancestors of the context will be queried
for a value with the same key in the Namespace used
to create this store. If no value is found for the supplied key,
a new value will be computed by the defaultCreator (given
the key as input), stored, and returned.
getOrComputeIfAbsent in interface ExtensionContext.StoreK - the key typeV - the value typekey - the key; never nulldefaultCreator - the function called with the supplied key
to create a new value; never nullrequiredType - the required type of the value; never nullnullExtensionContext.Store.getOrComputeIfAbsent(Object, Function)public void put(java.lang.Object key,
java.lang.Object value)
ExtensionContext.Storevalue for later retrieval under the supplied key.
A stored value is visible in child ExtensionContexts for the store's Namespace unless they
overwrite it.
put in interface ExtensionContext.Storekey - the key under which the value should be stored; never
nullvalue - the value to store; may be nullpublic java.lang.Object remove(java.lang.Object key)
ExtensionContext.Storekey.
The value will only be removed in the current ExtensionContext,
not in ancestors.
For greater type safety, consider using ExtensionContext.Store.remove(Object, Class)
instead.
remove in interface ExtensionContext.Storekey - the key; never nullnull if no value was present
for the specified keyExtensionContext.Store.remove(Object, Class)public <T> T remove(java.lang.Object key,
java.lang.Class<T> requiredType)
ExtensionContext.Storekey.
The value will only be removed in the current ExtensionContext,
not in ancestors.
remove in interface ExtensionContext.StoreT - the value typekey - the key; never nullrequiredType - the required type of the value; never nullnull if no value was present
for the specified keyExtensionContext.Store.remove(Object)