Context implementations are thread-safe and immutable: mutative operations like
put(Object, Object) will in fact return a new Context instance.
Note that contexts are optimized for low cardinality key/value storage, and a user
might want to associate a dedicated mutable structure to a single key to represent his
own context instead of using multiple put, which could be more costly.
Past five user key/value pair, the Context will use a copy-on-write
implementation backed by a new java. on each put.
| Modifier and Type | Method and Description |
|---|---|
| public Context | |
| public static Context | |
| public static Context | |
| public static Context | |
| public static Context | Returns: aContext with three entries.the first key to initialize. key1, Object the value for the first key. value1, Object the second key to initialize. key2, Object the value for the second key. value2, Object the third key to initialize. key3, Object the value for the third key. value3)Create a |
| public static Context | Returns: aContext with four entries.the first key to initialize. key1, Object the value for the first key. value1, Object the second key to initialize. key2, Object the value for the second key. value2, Object the third key to initialize. key3, Object the value for the third key. value3, Object the fourth key to initialize. key4, Object the value for the fourth key. value4)Create a |
| public static Context | Returns: aContext with five entries.the first key to initialize. key1, Object the value for the first key. value1, Object the second key to initialize. key2, Object the value for the second key. value2, Object the third key to initialize. key3, Object the value for the third key. value3, Object the fourth key to initialize. key4, Object the value for the fourth key. value4, Object the fifth key to initialize. key5, Object the value for the fifth key. value5)Create a |
| public static Context | |
| public static Context | Returns: the convertedContext for further modificationsthe contextView)ContextView to convert (or cast) to ContextCreate a |
| public Context | |
| public default Context | Returns: a newContext with a merge of the entries from this context and the given context.the other other)ContextView from which to copy entriesCreate a new |
| public default Context | Returns: a newContext with a merge of the entries from this context and the given context.the context)Context from which to copy entries
Deprecated
will be removed in 3.5, kept for backward compatibility with 3.3.
See putAll(ContextView).
|
| public default Context | |
| public default Context | |
| public default ContextView | Returns: theContextView of this contextSwitch to the |
| delete | back to summary |
|---|---|
| public Context delete(Object key) Return a new
Note that if this | |
| empty | back to summary |
|---|---|
| public static Context empty() Return an empty | |
| of | back to summary |
|---|---|
| public static Context of(Object key, Object value) Create a
| |
| of | back to summary |
|---|---|
| public static Context of(Object key1, Object value1, Object key2, Object value2) Create a | |
| of | back to summary |
|---|---|
| public static Context of(Object key1, Object value1, Object key2, Object value2, Object key3, Object value3) Create a
| |
| of | back to summary |
|---|---|
| public static Context of(Object key1, Object value1, Object key2, Object value2, Object key3, Object value3, Object key4, Object value4) Create a
| |
| of | back to summary |
|---|---|
| public static Context of(Object key1, Object value1, Object key2, Object value2, Object key3, Object value3, Object key4, Object value4, Object key5, Object value5) Create a
| |
| of | back to summary |
|---|---|
| public static Context of(Map<?, ?> map) Create a Implementation Note this method compacts smaller maps into a relevant fields-based implementation when map size is less than 6. | |
| of | back to summary |
|---|---|
| public static Context of(ContextView contextView) Create a
| |
| put | back to summary |
|---|---|
| public Context put(Object key, Object value) Create a new | |
| putAll | back to summary |
|---|---|
| public default Context putAll(ContextView other) Create a new
| |
| putAll | back to summary |
|---|---|
| public default Context putAll(Context context)
Deprecated will be removed in 3.5, kept for backward compatibility with 3.3. Until
then if you need to work around the deprecation, use See | |
| putAllMap | back to summary |
|---|---|
| public default Context putAllMap(Map<?, ?> from) Create a new | |
| putNonNull | back to summary |
|---|---|
| public default Context putNonNull(Object key, Object valueOrNull) Create a new
| |
| readOnly | back to summary |
|---|---|
| public default ContextView readOnly() Switch to the
| |