usingExtractedPairs

Add JSON name/value pairs by extracting values from a series of elements. Typically used with a forEach call, for example:

		members.add(Event::getTags).usingExtractedPairs(Iterable::forEach, pairExtractor);
		

When used with a named member, the pairs will be added as a new JSON value object:

		{
		  "name": {
		    "p1": 1,
		    "p2": 2
		  }
		}
		
When used with an unnamed member the pairs will be added to the existing JSON object:
		{
		  "p1": 1,
		  "p2": 2
		}
		

Return

a Member which may be configured further

Parameters

<E>

the element type

elements

callback used to provide the elements

extractor

a PairExtractor used to extract the name/value pair

See also


open fun <E, N, V> usingExtractedPairs(elements: BiConsumer<T, Consumer<E>>, nameExtractor: (E) -> N, valueExtractor: (E) -> V): JsonWriter.Member<T>

Add JSON name/value pairs by extracting values from a series of elements. Typically used with a forEach call, for example:

		members.add(Event::getTags).usingExtractedPairs(Iterable::forEach, Tag::getName, Tag::getValue);
		

When used with a named member, the pairs will be added as a new JSON value object:

		{
		  "name": {
		    "p1": 1,
		    "p2": 2
		  }
		}
		
When used with an unnamed member the pairs will be added to the existing JSON object:
		{
		  "p1": 1,
		  "p2": 2
		}
		

Return

a Member which may be configured further

Parameters

<E>

the element type

<N>

the name type

<V>

the value type

elements

callback used to provide the elements

nameExtractor

Function used to extract the name

valueExtractor

Function used to extract the value

See also