Interface TagExtractor<T>


public interface TagExtractor<T>
This provides an utility for extracting request/response tags, potentially allocation-free.

Tag should follow the OpenTracing tag names. This might change in the future if a new spec with a superset (semantically wise) of this list.

Author:
Julien Viet
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> TagExtractor<T>
     
    default Map<String,String>
    extract(T obj)
    Extract all the tags from obj into a Map<String, String>.
    default void
    extractTo(T obj, BiConsumer<String,String> consumer)
    Extract all the tags from obj into a tag consumer.
    default void
    extractTo(T obj, Map<String,String> tags)
    Extract all the tags from obj into the tags map.
    default int
    len(T obj)
    Returns the number of tags obj exposes.
    default String
    name(T obj, int index)
    Returns the name of the tag extracted from objat the specified index.
    default String
    value(T obj, int index)
    Returns the value of the tag extracted from obj at the specified index.
  • Method Details

    • empty

      static <T> TagExtractor<T> empty()
    • len

      default int len(T obj)
      Returns the number of tags obj exposes.
      Parameters:
      obj - the object to evaluate
      Returns:
      the number of tags
    • name

      default String name(T obj, int index)
      Returns the name of the tag extracted from objat the specified index.
      Parameters:
      obj - the object to extract the tag name from
      index - the index of the tag
      Returns:
      the tag name
    • value

      default String value(T obj, int index)
      Returns the value of the tag extracted from obj at the specified index.
      Parameters:
      obj - the object to extract the tag name from
      index - the index of the tag
      Returns:
      the tag value
    • extract

      default Map<String,String> extract(T obj)
      Extract all the tags from obj into a Map<String, String>.
      Parameters:
      obj - the object to extract the tags from
      Returns:
      the map of all tags extracted from the object
    • extractTo

      default void extractTo(T obj, Map<String,String> tags)
      Extract all the tags from obj into the tags map.
      Parameters:
      obj - the object to extract the tags from
      tags - the map populated with the tags extracted from the object
    • extractTo

      default void extractTo(T obj, BiConsumer<String,String> consumer)
      Extract all the tags from obj into a tag consumer.
      Parameters:
      obj - the object to extract the tags from
      consumer - the consumer populated with the tags extracted from the object