Interface JsonWriter.PairExtractor<E>

Type Parameters:
E - the element type
Enclosing interface:
JsonWriter<T>

public static interface JsonWriter.PairExtractor<E>
Interface that can be used to extract name/value pairs from an element.
  • Method Details

    • getName

      <N> N getName(E element)
      Extract the name.
      Type Parameters:
      N - the name type
      Parameters:
      element - the source element
      Returns:
      the extracted name
    • getValue

      <V> V getValue(E element)
      Extract the name.
      Type Parameters:
      V - the value type
      Parameters:
      element - the source element
      Returns:
      the extracted value
    • of

      static <T> JsonWriter.PairExtractor<T> of(Function<T,?> nameExtractor, Function<T,?> valueExtractor)
      Factory method to create a JsonWriter.PairExtractor using distinct name and value extraction functions.
      Type Parameters:
      T - the element type
      Parameters:
      nameExtractor - the name extractor
      valueExtractor - the value extraction
      Returns:
      a new JsonWriter.PairExtractor instance