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.
- Since:
- 3.4.0
- Author:
- Phillip Webb, Moritz Halbritter
-
Method Summary
Modifier and TypeMethodDescription<N> N
Extract the name.<V> V
Extract the name.static <T> JsonWriter.PairExtractor
<T> Factory method to create aJsonWriter.PairExtractor
using distinct name and value extraction functions.
-
Method Details
-
getName
Extract the name.- Type Parameters:
N
- the name type- Parameters:
element
- the source element- Returns:
- the extracted name
-
getValue
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 aJsonWriter.PairExtractor
using distinct name and value extraction functions.- Type Parameters:
T
- the element type- Parameters:
nameExtractor
- the name extractorvalueExtractor
- the value extraction- Returns:
- a new
JsonWriter.PairExtractor
instance
-