Package org.eclipse.ditto.json
Class JsonCollectors
- java.lang.Object
-
- org.eclipse.ditto.json.JsonCollectors
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Collector<JsonField,JsonArrayBuilder,JsonArray>
fieldKeysToArray()
Returns aCollector
that accumulates the key names of input JSON fields into a newJsonArray
.static Collector<JsonField,JsonObjectBuilder,JsonObject>
fieldsToObject()
Returns aCollector
that accumulates the input JSON fields into a newJsonObject
.static Collector<JsonField,JsonArrayBuilder,JsonArray>
fieldValuesToArray()
Returns aCollector
that accumulates the values of input JSON fields into a newJsonArray
.static Collector<JsonObject,JsonObjectBuilder,JsonObject>
objectsToObject()
Returns aCollector
that accumulates the input JSON objects into a newJsonObject
.static Collector<JsonValue,JsonArrayBuilder,JsonArray>
valuesToArray()
Returns aCollector
that accumulates the input JSON values into a newJsonArray
.
-
-
-
Method Detail
-
fieldsToObject
public static Collector<JsonField,JsonObjectBuilder,JsonObject> fieldsToObject()
Returns aCollector
that accumulates the input JSON fields into a newJsonObject
.- Returns:
- a
Collector
which collects all the JSON fields into aJsonObject
, in encounter order.
-
objectsToObject
public static Collector<JsonObject,JsonObjectBuilder,JsonObject> objectsToObject()
Returns aCollector
that accumulates the input JSON objects into a newJsonObject
.- Returns:
- a
Collector
which collects all the JSON object into aJsonObject
, in encounter order.
-
fieldKeysToArray
public static Collector<JsonField,JsonArrayBuilder,JsonArray> fieldKeysToArray()
Returns aCollector
that accumulates the key names of input JSON fields into a newJsonArray
. The values are hereby dismissed.- Returns:
- a
Collector
which collects the key names of all the JSON fields into aJsonArray
, in encounter order.
-
fieldValuesToArray
public static Collector<JsonField,JsonArrayBuilder,JsonArray> fieldValuesToArray()
Returns a
Collector
that accumulates the values of input JSON fields into a newJsonArray
. The keys are hereby dismissed.Caution: Due to the fact that each field of a JSON object can have a different type the resulting array will also consist of values of different types!
- Returns:
- a
Collector
which collects the values of all the JSON fields into aJsonArray
, in encounter order.
-
valuesToArray
public static Collector<JsonValue,JsonArrayBuilder,JsonArray> valuesToArray()
Returns aCollector
that accumulates the input JSON values into a newJsonArray
.- Returns:
- a
Collector
which collects all the JSON values into aJsonArray
, in encounter order.
-
-