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 TypeMethodDescriptionadd
(@NonNull PropagatedContextElement element) Modifies the context by adding an element.The mutated context.static @NonNull MutablePropagatedContext
of
(@NonNull PropagatedContext propagatedContext) Creates a mutable propagated context with the initial context.remove
(@NonNull PropagatedContextElement element) Modifies the context by removing the provided element.replace
(@NonNull PropagatedContextElement oldElement, @NonNull PropagatedContextElement newElement) Modifies the context by replacing the provided element.
-
Method Details
-
of
@NonNull static @NonNull MutablePropagatedContext of(@NonNull @NonNull PropagatedContext propagatedContext) 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
@NonNull @NonNull MutablePropagatedContext remove(@NonNull @NonNull PropagatedContextElement element) Modifies the context by removing the provided element.- Parameters:
element
- The context element to be removed- Returns:
- the current mutable propagated context.
-
replace
@NonNull @NonNull MutablePropagatedContext replace(@NonNull @NonNull PropagatedContextElement oldElement, @NonNull @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
The mutated context.- Returns:
- The propagated context that is being mutated.
-