ContextSnapshot objects and restoring ThreadLocal
values using a context object for which a ContextAccessor exists in the
ContextRegistry.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ContextSnapshotFactory.Builder
Builder for |
| Modifier and Type | Method and Description |
|---|---|
| public static ContextSnapshotFactory. | Returns: an instance that provides defaults, that can be configured to provide to the createdContextSnapshotFactory.Creates a builder for configuring the factory. |
| public ContextSnapshot | Returns: a snapshot with saved context valuescontext objects to extract values from contexts)Capture values from |
| public ContextSnapshot | Returns: the createdContextSnapshotthe contexts to read values from contexts)Create a |
| public < the type of the target context C> ContextSnapshot. | Returns: an object that can be used to resetThreadLocal values at the end
of the context scope, either removing them or restoring their previous values, if
any.the source context to read values from sourceContext, String... the keys of the values to read. If none provided, all keys are
considered. keys)Read the values specified by keys from the given source context, and if found, use
them to set |
| builder | back to summary |
|---|---|
| public static ContextSnapshotFactory. Creates a builder for configuring the factory.
| |
| captureAll | back to summary |
|---|---|
| public ContextSnapshot captureAll(Object... contexts) Capture values from Values captured multiple times are overridden in the snapshot by the order of contexts given as arguments.
| |
| captureFrom | back to summary |
|---|---|
| public ContextSnapshot captureFrom(Object... contexts) Create a Values captured multiple times are overridden in the snapshot by the order of contexts given as arguments.
| |
| setThreadLocalsFrom | back to summary |
|---|---|
| public <C> ContextSnapshot. Read the values specified by keys from the given source context, and if found, use
them to set
| |
ContextSnapshotFactory instances.
| Modifier and Type | Method and Description |
|---|---|
| public ContextSnapshotFactory | Returns: an instance configured by the values set on the builderCreates a new instance of |
| public ContextSnapshotFactory. | Returns: this builder instancepredicate used to select matching keys captureKeyPredicate)Instructs the factory to use the given predicate to select matching keys when
capturing |
| public ContextSnapshotFactory. | Returns: this builder instanceif shouldClear)true, values not present in the context object or
snapshot will be cleared at the start of a scope and later restoredDetermines whether to clear existing |
| public ContextSnapshotFactory. | Returns: this builder instancethe registry to use contextRegistry)Configures the |
| build | back to summary |
|---|---|
| public ContextSnapshotFactory build() Creates a new instance of
| |
| captureKeyPredicate | back to summary |
|---|---|
| public ContextSnapshotFactory. Instructs the factory to use the given predicate to select matching keys when
capturing
| |
| clearMissing | back to summary |
|---|---|
| public ContextSnapshotFactory. Determines whether to clear existing
| |
| contextRegistry | back to summary |
|---|---|
| public ContextSnapshotFactory. Configures the
| |