Interface Propagator.Getter<C>
- Type Parameters:
C- carrier of propagation fields, such as an http request.
- Enclosing interface:
Propagator
public static interface Propagator.Getter<C>
Interface that allows to read propagated fields from a carrier.
Getter is stateless and allows to be saved as a constant to avoid runtime
allocations.
- Since:
- 1.10.0
-
Method Summary
-
Method Details
-
get
Returns the first value of the given propagationkeyor returnsnull. This method should be preferred overgetAll(Object, String)} for better performance in cases where it is expected that the key is not repeated.- Parameters:
carrier- carrier of propagation fields, such as an http request.key- the key of the field.- Returns:
- the first value of the given propagation
keyor returnsnull.
-
getAll
Get all values of the given propagationkey, if any exist. This should only be used when it is expected that the key may be repeated.get(Object, String)should be preferred in other cases for performance.- Parameters:
carrier- carrier of propagation fields, such as an http request.key- the key of the field.- Returns:
- all values of the given propagation
keyor returns an emptyIterableif no values are found. - Since:
- 1.16.0
- Implementation Note:
- For backward-compatibility, a default implementation is provided that
returns a list with the value of
get(Object, String)or an empty list if no values are found. Implementors of this interface should override this method to provide an implementation that returns all present values of the given propagationkey.
-