MultiLineString implements CoordinateContainer<List<List<Point>>> { public static MultiLineString fromJson(@NonNull String json) { GsonBuilder gson = new GsonBuilder(); gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create()); return gson.create().fromJson(json, MultiLineString.class); } MultiLineString(String type, @Nullable BoundingBox bbox, List<List<Point>> coordinates); static MultiLineString fromJson(@NonNull String json); static MultiLineString fromLineStrings(@NonNull List<LineString> lineStrings); static MultiLineString fromLineStrings(@NonNull List<LineString> lineStrings,
                                                @Nullable BoundingBox bbox); static MultiLineString fromLineString(@NonNull LineString lineString); static MultiLineString fromLineString(@NonNull LineString lineString,
                                               @Nullable BoundingBox bbox); static MultiLineString fromLngLats(@NonNull List<List<Point>> points); static MultiLineString fromLngLats(@NonNull List<List<Point>> points,
                                            @Nullable BoundingBox bbox); @NonNull @Override String type(); @Nullable @Override BoundingBox bbox(); @NonNull @Override List<List<Point>> coordinates(); List<LineString> lineStrings(); @Override String toJson(); static TypeAdapter<MultiLineString> typeAdapter(Gson gson); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void fromJson() throws IOException { final String json = "{\"type\": \"MultiLineString\", " + "\"coordinates\": [[[100, 0],[101, 1]],[[102, 2],[103, 3]]] }"; MultiLineString geo = MultiLineString.fromJson(json); assertEquals("MultiLineString", geo.type()); assertEquals(geo.coordinates().get(0).get(0).longitude(), 100.0, DELTA); assertEquals(geo.coordinates().get(0).get(0).latitude(), 0.0, DELTA); assertFalse(geo.coordinates().get(0).get(0).hasAltitude()); }
@Test public void fromJson_coordinatesPresent() throws Exception { thrown.expect(NullPointerException.class); MultiLineString.fromJson("{\"type\":\"MultiLineString\",\"coordinates\":null}"); }