Top Constructors Methods
reactor.util.context

pack-priv final Class ContextN

extends LinkedHashMap<Object, Object>
implements CoreContext, BiConsumer<Object, Object>, Consumer<Map.Entry<Object, Object>>
Class Inheritance
All Implemented Interfaces
java.util.function.Consumer, java.util.function.BiConsumer, reactor.util.context.CoreContext, reactor.util.context.Context, reactor.util.context.ContextView
Annotations
@SuppressWarnings:unchecked
Imports
java.util.AbstractMap, .LinkedHashMap, .Map, .Map.Entry, .NoSuchElementException, .Objects, java.util.function.BiConsumer, .Consumer, java.util.stream.Stream, reactor.util.annotation.Nullable

Constructor Summary

AccessConstructor and Description
pack-priv
ContextN(Object key1, Object value1, Object key2, Object value2, Object key3, Object value3, Object key4, Object value4, Object key5, Object value5, Object key6, Object value6)

pack-priv
ContextN(Map<Object, Object>
a Map to populate entries from. MUST NOT contain null keys/values
originalToCopy
)

Creates a new ContextN with values from the provided Map

pack-priv
ContextN(int initialCapacity)

Method Summary

Modifier and TypeMethod and Description
public void
accept(Object
the first input argument
key
,
Object
the second input argument
value
)

Implements java.util.function.BiConsumer.accept.

Performs this operation on the given arguments.
public void
accept(Map.Entry<Object, Object>
the input argument
entry
)

Implements java.util.function.Consumer.accept.

Performs this operation on the given argument.
public Context
delete(Object
the key to remove.
key
)

Implements reactor.util.context.Context.delete.

Return a new Context that will resolve all existing keys except the removed one, key.
public Object
get(Object
a lookup key to resolve the value within the context
key
)

Overrides java.util.LinkedHashMap.get.

Implements reactor.util.context.ContextView.get, java.util.Map.get.

Resolve a value given a key that exists within the Context, or throw a NoSuchElementException if the key is not present.
public Object
getOrDefault(Object
a lookup key to resolve the value within the context
key
,
Object
a fallback value if key doesn't resolve
defaultValue
)

Overrides java.util.LinkedHashMap.getOrDefault.

Overrides default reactor.util.context.ContextView.getOrDefault, java.util.Map.getOrDefault.

Resolve a value given a key within the Context.
public boolean
hasKey(Object
a lookup key to test for
key
)

Implements reactor.util.context.ContextView.hasKey.

Return true if a particular key resolves to a value within the Context.
public Context
put(Object
the key to add/update in the new Context
key
,
Object
the value to associate to the key in the new Context
value
)

Overrides java.util.HashMap.put.

Implements reactor.util.context.Context.put, java.util.Map.put.

Note that this method overrides LinkedHashMap#put(Object, Object).
public void
putAll(Map<?, ?>
mappings to be stored in this map
m
)

Overrides java.util.HashMap.putAll.

Implements java.util.Map.putAll.

This method is part of the Map API.
public Context
putAll(ContextView
the other ContextView from which to copy entries
other
)

Overrides default reactor.util.context.CoreContext.putAll.

Create a new Context by merging the content of this context and a given ContextView.
public Context
putAllInto(Context
the Context in which we're putting all our values
base
)

Implements reactor.util.context.CoreContext.putAllInto.

Let this Context add its internal values to the given base Context, avoiding creating intermediate holders for key-value pairs as much as possible.
public Context
putAllMap(Map<?, ?>
the Map from which to include entries in the resulting Context.
from
)

Overrides default reactor.util.context.Context.putAllMap.

Create a new Context by merging the content of this context and a given Map.
public Stream<Map.Entry<Object, Object>>
stream()

Implements reactor.util.context.ContextView.stream.

Stream key/value pairs from this Context
public String
toString()

Overrides java.util.AbstractMap.toString.

Returns a string representation of this map.
public void
unsafePutAllInto(ContextN
the ContextN we're mutating by putting all our values into
other
)

Implements reactor.util.context.CoreContext.unsafePutAllInto.

Let this Context add its internal values to the given ContextN, mutating it, but avoiding creating intermediate holders for key-value pairs as much as possible.
Inherited from java.util.LinkedHashMap:
clearcontainsValueentrySetforEachkeySetnewLinkedHashMapputFirstputLastremoveEldestEntryreplaceAllreversedsequencedEntrySetsequencedKeySetsequencedValuesvalues

Constructor Detail

ContextNback to summary
pack-priv ContextN(Object key1, Object value1, Object key2, Object value2, Object key3, Object value3, Object key4, Object value4, Object key5, Object value5, Object key6, Object value6)
ContextNback to summary
pack-priv ContextN(Map<Object, Object> originalToCopy)

Creates a new ContextN with values from the provided Map

Parameters
originalToCopy:Map<Object, Object>

a Map to populate entries from. MUST NOT contain null keys/values

ContextNback to summary
pack-priv ContextN(int initialCapacity)

Method Detail

acceptback to summary
public void accept(Object key, Object value)

Implements java.util.function.BiConsumer.accept.

Doc from java.util.function.BiConsumer.accept.

Performs this operation on the given arguments.

Parameters
key:Object

the first input argument

value:Object

the second input argument

Annotations
@Override
acceptback to summary
public void accept(Map.Entry<Object, Object> entry)

Implements java.util.function.Consumer.accept.

Doc from java.util.function.Consumer.accept.

Performs this operation on the given argument.

Parameters
entry:Map.Entry<Object, Object>

the input argument

Annotations
@Override
deleteback to summary
public Context delete(Object key)

Implements reactor.util.context.Context.delete.

Doc from reactor.util.context.Context.delete.

Return a new Context that will resolve all existing keys except the removed one, key.

Note that if this Context doesn't contain the key, this method simply returns this same instance.

Parameters
key:Object

the key to remove.

Returns:Context

a new Context that doesn't include the provided key

Annotations
@Override
getback to summary
public Object get(Object key)

Overrides java.util.LinkedHashMap.get.

Implements reactor.util.context.ContextView.get, java.util.Map.get.

Doc from reactor.util.context.ContextView.get.

Resolve a value given a key that exists within the Context, or throw a NoSuchElementException if the key is not present.

Parameters
key:Object

a lookup key to resolve the value within the context

Returns:Object

the value resolved for this key (throws if key not found)

Annotations
@Override
getOrDefaultback to summary
public Object getOrDefault(Object key, Object defaultValue)

Overrides java.util.LinkedHashMap.getOrDefault.

Overrides default reactor.util.context.ContextView.getOrDefault, java.util.Map.getOrDefault.

Doc from reactor.util.context.ContextView.getOrDefault.

Resolve a value given a key within the Context. If unresolved return the passed default value.

Parameters
key:Object

a lookup key to resolve the value within the context

defaultValue:Object

a fallback value if key doesn't resolve

Returns:Object

the value resolved for this key, or the given default if not present

Annotations
@Override
@Nullable
hasKeyback to summary
public boolean hasKey(Object key)

Implements reactor.util.context.ContextView.hasKey.

Doc from reactor.util.context.ContextView.hasKey.

Return true if a particular key resolves to a value within the Context.

Parameters
key:Object

a lookup key to test for

Returns:boolean

true if this context contains the given key

Annotations
@Override
putback to summary
public Context put(Object key, Object value)

Overrides java.util.HashMap.put.

Implements reactor.util.context.Context.put, java.util.Map.put.

Note that this method overrides LinkedHashMap#put(Object, Object). Consider using accept(Object, Object) instead for putting items into the map.

Parameters
key:Object

the key to add/update in the new Context

value:Object

the value to associate to the key in the new Context

Returns:Context

Doc from reactor.util.context.Context.put.

a new Context including the provided key/value

Annotations
@Override
putAllback to summary
public void putAll(Map<?, ?> m)

Overrides java.util.HashMap.putAll.

Implements java.util.Map.putAll.

This method is part of the Map API. As this is an internal implementation detail, no validation of the Map keys or values is performed. I.e. the caller must ensure they are not null, otherwise this Context will have disallowed mappings. Despite being public, this API is not exposed to end users and can be used internally for means of populating the inner contents of ContextN.

Parameters
m:Map<?, ?>

mappings to be stored in this map

putAllback to summary
public Context putAll(ContextView other)

Overrides default reactor.util.context.CoreContext.putAll.

Doc from reactor.util.context.Context.putAll.

Create a new Context by merging the content of this context and a given ContextView. If the other context is empty, the same Context instance is returned.

Parameters
other:ContextView

the other ContextView from which to copy entries

Returns:Context

a new Context with a merge of the entries from this context and the given context.

Annotations
@Override
putAllIntoback to summary
public Context putAllInto(Context base)

Implements reactor.util.context.CoreContext.putAllInto.

Doc from reactor.util.context.CoreContext.putAllInto.

Let this Context add its internal values to the given base Context, avoiding creating intermediate holders for key-value pairs as much as possible.

Parameters
base:Context

the Context in which we're putting all our values

Returns:Context

a new context containing all the base values merged with all our values

Annotations
@Override
putAllMapback to summary
public Context putAllMap(Map<?, ?> from)

Overrides default reactor.util.context.Context.putAllMap.

Doc from reactor.util.context.Context.putAllMap.

Create a new Context by merging the content of this context and a given Map. If the Map is empty, the same Context instance is returned.

Parameters
from:Map<?, ?>

the Map from which to include entries in the resulting Context.

Returns:Context

a new Context with a merge of the entries from this context and the given Map.

Annotations
@Override
streamback to summary
public Stream<Map.Entry<Object, Object>> stream()

Implements reactor.util.context.ContextView.stream.

Doc from reactor.util.context.ContextView.stream.

Stream key/value pairs from this Context

Returns:Stream<Map.Entry<Object, Object>>

a Stream of key/value pairs held by this context

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.util.AbstractMap.toString.

Doc from java.util.AbstractMap.toString.

Returns a string representation of this map. The string representation consists of a list of key-value mappings in the order returned by the map's entrySet view's iterator, enclosed in braces ("{}"). Adjacent mappings are separated by the characters ", " (comma and space). Each key-value mapping is rendered as the key followed by an equals sign ("=") followed by the associated value. Keys and values are converted to strings as by String#valueOf(Object).

Returns:String

a string representation of this map

Annotations
@Override
unsafePutAllIntoback to summary
public void unsafePutAllInto(ContextN other)

Implements reactor.util.context.CoreContext.unsafePutAllInto.

Doc from reactor.util.context.CoreContext.unsafePutAllInto.

Let this Context add its internal values to the given ContextN, mutating it, but avoiding creating intermediate holders for key-value pairs as much as possible.

Parameters
other:ContextN

the ContextN we're mutating by putting all our values into

Annotations
@Override