public final class JsonCollectors
extends java.lang.Object
java.util.stream.Collector for accumulating
JsonValues into JsonArray and JsonObject.| Modifier and Type | Method and Description |
|---|---|
static java.util.stream.Collector<JsonValue,java.util.Map<java.lang.String,JsonArrayBuilder>,JsonObject> |
groupingBy(java.util.function.Function<JsonValue,java.lang.String> classifier)
Constructs a
java.util.stream.Collector that implements a "group by" operation on the
input JsonValue elements. |
static <T extends JsonArrayBuilder> |
groupingBy(java.util.function.Function<JsonValue,java.lang.String> classifier,
java.util.stream.Collector<JsonValue,T,JsonArray> downstream)
Constructs a
java.util.stream.Collector that implements a "group by" operation on the
input JsonValue elements. |
static java.util.stream.Collector<JsonValue,JsonArrayBuilder,JsonArray> |
toJsonArray()
Constructs a
java.util.stream.Collector that accumulates the input JsonValue
elements into a JsonArray. |
static java.util.stream.Collector<java.util.Map.Entry<java.lang.String,JsonValue>,JsonObjectBuilder,JsonObject> |
toJsonObject()
Constructs a
java.util.stream.Collector that accumulates the input Map.Entry<String,JsonValue>
elements into a JsonObject. |
static java.util.stream.Collector<JsonValue,JsonObjectBuilder,JsonObject> |
toJsonObject(java.util.function.Function<JsonValue,java.lang.String> keyMapper,
java.util.function.Function<JsonValue,JsonValue> valueMapper)
Constructs a
java.util.stream.Collector that accumulates the input JsonValue
elements into a JsonObject. |
public static java.util.stream.Collector<JsonValue,JsonArrayBuilder,JsonArray> toJsonArray()
java.util.stream.Collector that accumulates the input JsonValue
elements into a JsonArray.public static java.util.stream.Collector<java.util.Map.Entry<java.lang.String,JsonValue>,JsonObjectBuilder,JsonObject> toJsonObject()
java.util.stream.Collector that accumulates the input Map.Entry<String,JsonValue>
elements into a JsonObject.public static java.util.stream.Collector<JsonValue,JsonObjectBuilder,JsonObject> toJsonObject(java.util.function.Function<JsonValue,java.lang.String> keyMapper, java.util.function.Function<JsonValue,JsonValue> valueMapper)
java.util.stream.Collector that accumulates the input JsonValue
elements into a JsonObject. The name/value pairs of the JsonObject are computed
by applying the provided mapping functions.keyMapper - a mapping function to produce names.valueMapper - a mapping function to produce valuespublic static <T extends JsonArrayBuilder> java.util.stream.Collector<JsonValue,java.util.Map<java.lang.String,T>,JsonObject> groupingBy(java.util.function.Function<JsonValue,java.lang.String> classifier, java.util.stream.Collector<JsonValue,T,JsonArray> downstream)
java.util.stream.Collector that implements a "group by" operation on the
input JsonValue elements. A classifier function maps the input JsonValues to keys, and
the JsonValues are partitioned into groups according to the value of the key.
A reduction operation is performed on the JsonValues in each group, using the
downstream Collector. For each group, the key and the results of the reduction operation
become the name/value pairs of the resultant JsonObject.T - the intermediate accumulation JsonArrayBuilder of the downstream collectorclassifier - a function mapping the input JsonValues to a String, producing keysdownstream - a Collector that implements a reduction operation on the
JsonValues in each group.Collectorpublic static java.util.stream.Collector<JsonValue,java.util.Map<java.lang.String,JsonArrayBuilder>,JsonObject> groupingBy(java.util.function.Function<JsonValue,java.lang.String> classifier)
java.util.stream.Collector that implements a "group by" operation on the
input JsonValue elements. A classifier function maps the input JsonValues to keys, and
the JsonValues are partitioned into groups according to the value of the key.
The JsonValues in each group are added to a JsonArray. The key and the
JsonArray in each group becomes the name/value pair of the resultant JsonObject.classifier - a function mapping the input JsonValues to a String, producing keysCollector