NamespacedHierarchicalStore is a hierarchical, namespaced key-value store.
Its closing behavior can be customized by passing a
CloseAction to the
NamespacedHierarchicalStore(NamespacedHierarchicalStore, CloseAction)
constructor.
This class is thread-safe. Please note, however, that thread safety is
not guaranteed while the close() method is being invoked.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | NamespacedHierarchicalStore.
Called for each successfully stored non-null value in the store when a
|
| private static record | |
| private static record | |
| private static class | NamespacedHierarchicalStore.
Thread-safe |
| private static record |
| Modifier and Type | Field and Description |
|---|---|
| private final @Nullable NamespacedHierarchicalStore. | |
| private volatile boolean | |
| private final AtomicInteger | |
| private final @Nullable NamespacedHierarchicalStore | |
| private final ConcurrentMap |
| Access | Constructor and Description |
|---|---|
| public | NamespacedHierarchicalStore(@Nullable NamespacedHierarchicalStore<N>
the parent store to use for lookups; may be parentStore)nullCreate a new store with the supplied parent. |
| public | NamespacedHierarchicalStore(@Nullable NamespacedHierarchicalStore<N>
the parent store to use for lookups; may be parentStore, @Nullable NamespacedHierarchicalStore.nullthe action to be called for each stored value when this
store is closed; may be closeActionnullCreate a new store with the supplied parent and close action. |
| Modifier and Type | Method and Description |
|---|---|
| private <T, V> T | |
| private <T> @Nullable T | |
| public void | close()
Implements java. If a |
| public <K, V> Object | Returns: the stored value; nevernullthe namespace; never namespace, K nullthe key; never key, Function<? super K, ? extends V> nullthe function called with the supplied defaultCreator)key
to create a new value; never null and must not return
nullReturn the value stored for the supplied namespace and key in this store
or the parent store, if present and not |
| public <K, V> V | Returns: the stored value; nevernullthe namespace; never namespace, K nullthe key; never key, Function<? super K, ? extends V> nullthe function called with the supplied defaultCreator, Class<V> key
to create a new value; never null and must not return
nullthe required type of the value; never requiredType)nullReturn the value stored for the supplied namespace and key in this store
or the parent store, if present and not |
| public @Nullable Object | |
| public <T> @Nullable T | Returns: the stored value; may benullthe namespace; never namespace, Object nullthe key; never key, Class<T> nullthe required type of the value; never requiredType)nullGet the value stored for the supplied namespace and key in this store or the parent store, if present, and cast it to the supplied required type. |
| public <K, V extends @Nullable Object> @Nullable Object | Returns: the stored value; may benullthe namespace; never namespace, K nullthe key; never key, Function<? super K, ? extends V> nullthe function called with the supplied defaultCreator)key
to create a new value; never null but may return null
Deprecated
since 6.0. Please use
computeIfAbsent(Object, Object, Function) instead.
Get the value stored for the supplied namespace and key in this store or the parent store, if present, or call the supplied function to compute it. |
| public <K, V extends @Nullable Object> @Nullable V | Returns: the stored value; may benullthe namespace; never namespace, K nullthe key; never key, Function<? super K, ? extends V> nullthe function called with the supplied defaultCreator, Class<V> key
to create a new value; never null but may return nullthe required type of the value; never requiredType)null
Deprecated
since 6.0. Please use
computeIfAbsent(Object, Object, Function, Class) instead.
Get the value stored for the supplied namespace and key in this store or the parent store, if present, or call the supplied function to compute it and, finally, cast it to the supplied required type. |
| public Optional | Returns: anOptional containing the parent store, or an empty Optional if there is no parentReturns the parent store of this |
| private @Nullable NamespacedHierarchicalStore. | |
| public boolean | |
| public NamespacedHierarchicalStore | |
| private NamespacedHierarchicalStore. | |
| public @Nullable Object | Returns: the previously stored value; may benullthe namespace; never namespace, Object nullthe key; never key, @Nullable Object nullthe value to store; may be value)nullPut the supplied value for the supplied namespace and key into this store and return the previously associated value in this store. |
| private void | |
| public @Nullable Object | |
| public <T> @Nullable T | Returns: the previously stored value; may benullthe namespace; never namespace, Object nullthe key; never key, Class<T> nullthe required type of the value; never requiredType)nullRemove the value stored for the supplied namespace and key from this store and cast it to the supplied required type. |