public static interface ExtensionContext.Store
Store provides methods for extensions to save and retrieve data.| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
get(java.lang.Object key)
Get an object that has been stored using a
key. |
java.lang.Object |
getOrComputeIfAbsent(java.lang.Object key,
java.util.function.Function<java.lang.Object,java.lang.Object> defaultCreator)
Get the object that is stored under the supplied
key. |
void |
put(java.lang.Object key,
java.lang.Object value)
Store a
value for later retrieval using a key. |
java.lang.Object |
remove(java.lang.Object key)
Remove a value that was previously stored using
key so that key can be used anew. |
java.lang.Object get(java.lang.Object key)
key.
If no value has been saved in the current ExtensionContext for this key,
the ancestors are asked for a value with the same key in the store's Namespace.
key - the keyvoid put(java.lang.Object key,
java.lang.Object value)
value for later retrieval using a key. null is a valid value.
A stored value is visible in offspring ExtensionContexts
for the store's Namespace unless they overwrite it.
key - the keyvalue - the valuejava.lang.Object getOrComputeIfAbsent(java.lang.Object key,
java.util.function.Function<java.lang.Object,java.lang.Object> defaultCreator)
key.
If no value is currently stored under the supplied key,
a new value will be computed by the defaultCreator, stored,
and returned.
key - the keydefaultCreator - the function called to create new valuesjava.lang.Object remove(java.lang.Object key)
key so that key can be used anew.
The key will only be removed in the current ExtensionContext not in ancestors.
key - the keynull if no value was present
for the specified key