Interface TextMapGetter<C>

Type Parameters:
C - carrier of propagation fields, such as an http request.

public interface TextMapGetter<C>
Interface that allows a TextMapPropagator to read propagated fields from a carrier.

Getter is stateless and allows to be saved as a constant to avoid runtime allocations.

  • Method Summary

    Modifier and Type
    Method
    Description
    get(C carrier, String key)
    Returns the first value of the given propagation key or returns null.
    default Iterator<String>
    getAll(C carrier, String key)
    If implemented, returns all values for a given key in order, or returns an empty list.
    keys(C carrier)
    Returns all the keys in the given carrier.
  • Method Details

    • keys

      Iterable<String> keys(C carrier)
      Returns all the keys in the given carrier.
      Parameters:
      carrier - carrier of propagation fields, such as an http request.
      Since:
      0.10.0
    • get

      @Nullable String get(@Nullable C carrier, String key)
      Returns the first value of the given propagation key or returns null.
      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 key or returns null.
    • getAll

      default Iterator<String> getAll(@Nullable C carrier, String key)
      If implemented, returns all values for a given key in order, or returns an empty list.

      The default method returns the first value of the given propagation key as a singleton list, or returns an empty list.

      Parameters:
      carrier - carrier of propagation fields, such as an http request.
      key - the key of the field.
      Returns:
      all values for a given key in order, or returns an empty list. Default method wraps get() as an Iterator.
      Since:
      1.50.0