public final class JsonDecoder extends Object
| Modifier | Constructor and Description |
|---|---|
private |
JsonDecoder() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static double[] |
decodeDoublePair(javax.json.JsonArray json)
Decodes a pair of double values, which are stored in a
JsonArray of exactly size 2. |
static <T> Collection<T> |
decodeFeatureCollection(javax.json.JsonObject json,
Function<javax.json.JsonObject,T> featureDecoder)
Parses a given
JsonObject as a GeoJSON FeatureCollection into a Collection
of the desired Java objects. |
(package private) static LatLon |
decodeLatLon(javax.json.JsonArray json)
Decodes a
JsonArray of exactly size 2 to a LatLon instance. |
(package private) static Long |
decodeTimestamp(String timestamp)
Decodes a timestamp formatted as a
String to the equivalent UNIX epoch timestamp
(number of milliseconds since 1970-01-01T00:00:00.000+0000). |
private JsonDecoder()
public static <T> Collection<T> decodeFeatureCollection(javax.json.JsonObject json, Function<javax.json.JsonObject,T> featureDecoder)
JsonObject as a GeoJSON FeatureCollection into a Collection
of the desired Java objects. The method, which converts the GeoJSON features into Java objects
is given as a parameter to this method.T - feature typejson - the JsonObject to be parsedfeatureDecoder - feature decoder which transforms JSON objects to Java objectsCollection which is parsed from the given JsonObject, which contains GeoJSON.
Currently a HashSet is used, but please don't rely on it, this could change at any time without
prior notice. The return value will not be null.static LatLon decodeLatLon(javax.json.JsonArray json)
JsonArray of exactly size 2 to a LatLon instance.
The first value in the JsonArray is treated as longitude, the second one as latitude.json - the JsonArray containing the two numbersLatLon instance, or null if the parameter is
not a JsonArray of exactly size 2 containing two JsonNumbers.static double[] decodeDoublePair(javax.json.JsonArray json)
JsonArray of exactly size 2.json - the JsonArray containing the two valuesnull
if the parameter was not a JsonArray of exactly size 2 containing two JsonNumbersstatic Long decodeTimestamp(String timestamp)
String to the equivalent UNIX epoch timestamp
(number of milliseconds since 1970-01-01T00:00:00.000+0000).timestamp - the timestamp formatted according to the format yyyy-MM-dd'T'HH:mm:ss.SSSXLong value representing the UNIX epoch time, or null if the
parameter does not match the required format (this also triggers a warning via
Logging.warn(Throwable)), or the parameter is null.