Package io.micronaut.core.propagation
Interface MutablePropagatedContext
public interface MutablePropagatedContext
Mutable propagated context will modify the internal context
Intended for use-cases when the propagated context needs to be mutated and propagated later.
- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescription@NonNull MutablePropagatedContextadd(@NonNull PropagatedContextElement element) Modifies the context by adding an element.@Nullable PropagatedContextThe mutated context.static @NonNull MutablePropagatedContextof(@NonNull PropagatedContext propagatedContext) Creates a mutable propagated context with the initial context.@NonNull MutablePropagatedContextremove(@NonNull PropagatedContextElement element) Modifies the context by removing the provided element.@NonNull MutablePropagatedContextreplace(@NonNull PropagatedContextElement oldElement, @NonNull PropagatedContextElement newElement) Modifies the context by replacing the provided element.
-
Method Details
-
of
Creates a mutable propagated context with the initial context.- Parameters:
propagatedContext- The initial context- Returns:
- new mutable propagated context
-
add
Modifies the context by adding an element.- Parameters:
element- The element element to be added- Returns:
- the current mutable propagated context.
-
remove
Modifies the context by removing the provided element.- Parameters:
element- The context element to be removed- Returns:
- the current mutable propagated context.
-
replace
@NonNull MutablePropagatedContext replace(@NonNull PropagatedContextElement oldElement, @NonNull PropagatedContextElement newElement) Modifies the context by replacing the provided element.- Parameters:
oldElement- The context element to be replacednewElement- The context element to be replaced with- Returns:
- the current mutable propagated context.
-
getContext
@Nullable PropagatedContext getContext()The mutated context.- Returns:
- The propagated context that is being mutated.
-