Top Description Constructors Methods
reactor.util.context

public final Class ReactorContextAccessor

extends Object
implements ContextAccessor<ContextView, Context>
Class Inheritance
All Implemented Interfaces
io.micrometer.context.ContextAccessor
Imports
java.util.Map, java.util.function.Predicate, io.micrometer.context.ContextAccessor, reactor.util.annotation.Nullable

A ContextAccessor to enable reading values from a Reactor ContextView and writing values to Context.

Please note that this public class implements the libs.micrometer.contextPropagation SPI library, which is an optional dependency.

Authors
Rossen Stoyanchev, Simon Baslé
Since
3.5.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Class<? extends ContextView>
readableType()

Implements io.micrometer.context.ContextAccessor.readableType.

Class representing the type of context this accessor is capable of reading values from.
public <T> T
readValue(ContextView
the context to read from; the context type should be assignable from the type returned by readableType().
sourceContext
,
Object
the key to use to look up the context value
key
)

Implements io.micrometer.context.ContextAccessor.readValue.

Read a single value from the source context.
public void
readValues(ContextView
the context to read from; the context type should be assignable from the type returned by readableType().

When an ContextAccessor is used to populate a ContextSnapshot, the snapshot implementations are required to filter out null mappings, so it is not required to implement special handling in the accessor.

source
,
Predicate<Object>
a predicate to decide which keys to read
keyPredicate
,
Map<Object, Object>
a map where to put read values
target
)

Implements io.micrometer.context.ContextAccessor.readValues.

Read values from a source context into a Map.
public Class<? extends Context>
writeableType()

Implements io.micrometer.context.ContextAccessor.writeableType.

Class representing the type of context this accessor can restore values to.
public Context
writeValues(Map<Object, Object>
the values to write to the target context.
source
,
Context
the context to write to; the context type should be assignable from the type returned by writeableType().
target
)

Implements io.micrometer.context.ContextAccessor.writeValues.

Write values from a Map to a target context.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ReactorContextAccessorback to summary
public ReactorContextAccessor()

Method Detail

readableTypeback to summary
public Class<? extends ContextView> readableType()

Implements io.micrometer.context.ContextAccessor.readableType.

Doc from io.micrometer.context.ContextAccessor.readableType.

Class representing the type of context this accessor is capable of reading values from.

Annotations
@Override
readValueback to summary
public <T> T readValue(ContextView sourceContext, Object key)

Implements io.micrometer.context.ContextAccessor.readValue.

Doc from io.micrometer.context.ContextAccessor.readValue.

Read a single value from the source context.

Parameters
sourceContext:ContextView

the context to read from; the context type should be assignable from the type returned by readableType().

key:Object

the key to use to look up the context value

Returns:T

the value, if present

Annotations
@Override
@Nullable
readValuesback to summary
public void readValues(ContextView source, Predicate<Object> keyPredicate, Map<Object, Object> target)

Implements io.micrometer.context.ContextAccessor.readValues.

Doc from io.micrometer.context.ContextAccessor.readValues.

Read values from a source context into a Map.

Parameters
source:ContextView

the context to read from; the context type should be assignable from the type returned by readableType().

When an ContextAccessor is used to populate a ContextSnapshot, the snapshot implementations are required to filter out null mappings, so it is not required to implement special handling in the accessor.

keyPredicate:Predicate<Object>

a predicate to decide which keys to read

target:Map<Object, Object>

a map where to put read values

Annotations
@Override
writeableTypeback to summary
public Class<? extends Context> writeableType()

Implements io.micrometer.context.ContextAccessor.writeableType.

Doc from io.micrometer.context.ContextAccessor.writeableType.

Class representing the type of context this accessor can restore values to.

Annotations
@Override
writeValuesback to summary
public Context writeValues(Map<Object, Object> source, Context target)

Implements io.micrometer.context.ContextAccessor.writeValues.

Doc from io.micrometer.context.ContextAccessor.writeValues.

Write values from a Map to a target context.

Parameters
source:Map<Object, Object>

the values to write to the target context.

target:Context

the context to write to; the context type should be assignable from the type returned by writeableType().

Returns:Context

a context with the written values

Annotations
@Override