public interface AsyncContextMap
AsyncContext.| Modifier and Type | Interface and Description |
|---|---|
static class |
AsyncContextMap.Key<T>
A key identifies a specific object in a
AsyncContextMap. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the contents of this
AsyncContextMap. |
boolean |
containsKey(AsyncContextMap.Key<?> key)
Determine if this context contains a key/value entry corresponding to
key. |
AsyncContextMap |
copy()
Create an isolated copy of the current map.
|
AsyncContextMap.Key<?> |
forEach(BiPredicate<AsyncContextMap.Key<?>,Object> consumer)
Iterate over the key/value pairs contained in this request context.
|
<T> T |
get(AsyncContextMap.Key<T> key)
Get the value associated with
key, or null if no value is associated. |
boolean |
isEmpty()
Determine if there are no key/value pairs in this
AsyncContextMap. |
<T> T |
put(AsyncContextMap.Key<T> key,
T value)
Put a new key/value pair into this
AsyncContextMap. |
void |
putAll(Map<AsyncContextMap.Key<?>,Object> map)
Put all the key/value pairs into this
AsyncContextMap. |
<T> T |
remove(AsyncContextMap.Key<T> key)
Remove a key/value pair from this
AsyncContextMap, and get the previous value (if one exists). |
boolean |
removeAll(Iterable<AsyncContextMap.Key<?>> entries)
Remove all key/value pairs from this
AsyncContextMap associated with the keys from the Iterable. |
int |
size()
Determine the number of
AsyncContextMap.Key-value mappings. |
@Nullable <T> T get(AsyncContextMap.Key<T> key)
key, or null if no value is associated.T - The anticipated type of object associated with key.key - the key to lookup.key, or null if no value is associated.boolean containsKey(AsyncContextMap.Key<?> key)
key.key - the key to lookup.true if this context contains a key/value entry corresponding to key.
false otherwise.boolean isEmpty()
AsyncContextMap.true if there are no key/value pairs in this AsyncContextMap.int size()
AsyncContextMap.Key-value mappings.AsyncContextMap.Key-value mappings.@Nullable <T> T put(AsyncContextMap.Key<T> key, T value)
AsyncContextMap.T - The type of object associated with key.key - the key used to index value. Cannot be null.value - the value to put.key, or null if there was none. A null
value may also indicate there was a previous value which was null.NullPointerException - if key is null, or value is null.UnsupportedOperationException - if this method is not supported.void putAll(Map<AsyncContextMap.Key<?>,Object> map)
AsyncContextMap.map - The entries to insert into this AsyncContextMap.ConcurrentModificationException - Done on a best effort basis if entries is detected to be modified
while attempting to put all entries.UnsupportedOperationException - if this method is not supported.@Nullable <T> T remove(AsyncContextMap.Key<T> key)
AsyncContextMap, and get the previous value (if one exists).T - The type of object associated with key.key - The key which identifies the key/value to remove.key, or null if there was none. A null
value may also indicate there was a previous value which was null.
If the AsyncContextMap implementation is immutable this may be a new object.UnsupportedOperationException - if this method is not supported.boolean removeAll(Iterable<AsyncContextMap.Key<?>> entries)
AsyncContextMap associated with the keys from the Iterable.entries - The entries to remove from this AsyncContextMap.true if this map has changed as a result of this operation.ConcurrentModificationException - Done on a best effort basis if entries is detected to be modified
while attempting to remove all entries.UnsupportedOperationException - if this method is not supported.void clear()
AsyncContextMap.UnsupportedOperationException - if this method is not supported.@Nullable AsyncContextMap.Key<?> forEach(BiPredicate<AsyncContextMap.Key<?>,Object> consumer)
consumer - Each key/value pair will be passed as arguments to this BiPredicate. Returns true
if the consumer wants to keep iterating or false to stop iteration at the current key/value pair.null if consumer iterated through all key/value pairs or the AsyncContextMap.Key
at which the iteration stopped.AsyncContextMap copy()
AsyncContextMap but modifications to this AsyncContextMap are not visible in the return value,
and visa-versa.AsyncContextMap but
modifications to this AsyncContextMap are not visible in the return value, and visa-versa.