diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Feature.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Feature.java
index 761aa99be..486cb4d07 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Feature.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Feature.java
@@ -8,7 +8,9 @@
import com.mapbox.services.commons.models.Position;
/**
- * Created by antonio on 1/30/16.
+ * A GeoJSON object with the type "Feature" is a feature object.
+ *
+ * @see Official GeoJSON Feature Specifications
*/
public class Feature implements GeoJSON {
@@ -17,57 +19,92 @@ public class Feature implements GeoJSON {
private final JsonObject properties;
private final String id;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param geometry {@link Geometry} object.
+ * @param properties of this feature as JSON.
+ * @param id common identifier of this feature.
*/
-
private Feature(Geometry geometry, JsonObject properties, String id) {
this.geometry = geometry;
this.properties = properties;
this.id = id;
}
- /*
- * Getters
+ /**
+ * Should always be "Feature".
+ *
+ * @return String "Feature".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the features {@link Geometry}.
+ *
+ * @return {@link Geometry} of the feature or null if not set.
+ */
public Geometry getGeometry() {
return geometry;
}
+ /**
+ * Returns the optional properties of this feature as JSON.
+ *
+ * @return the properties of this feature
+ */
public JsonObject getProperties() {
return properties;
}
+ /**
+ * The optional, common identifier of this feature.
+ *
+ * @return The common identifier of this feature, if set.
+ */
public String getId() {
return id;
}
- /*
- * Factories
+ /**
+ * Create a feature from geometry.
+ *
+ * @param geometry {@link Geometry} object.
*/
-
public static Feature fromGeometry(Geometry geometry) {
return new Feature(geometry, null, null);
}
+ /**
+ * Create a feature from geometry.
+ *
+ * @param geometry {@link Geometry} object.
+ * @param properties of this feature as JSON.
+ */
public static Feature fromGeometry(Geometry geometry, JsonObject properties) {
return new Feature(geometry, properties, null);
}
+ /**
+ * Create a feature from geometry.
+ *
+ * @param geometry {@link Geometry} object.
+ * @param properties of this feature as JSON.
+ * @param id common identifier of this feature.
+ */
public static Feature fromGeometry(Geometry geometry, JsonObject properties, String id) {
return new Feature(geometry, properties, id);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON feature object from JSON.
+ *
+ * @param json String of JSON making up a feature.
+ * @return {@link Feature} GeoJSON object.
*/
-
public static Feature fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
@@ -75,11 +112,15 @@ public static Feature fromJson(String json) {
return gson.create().fromJson(json, Feature.class);
}
+ /**
+ * Convert feature into JSON.
+ *
+ * @return String containing feature JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/FeatureCollection.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/FeatureCollection.java
index 94b6774bb..b1ce76a2d 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/FeatureCollection.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/FeatureCollection.java
@@ -9,46 +9,60 @@
import java.util.List;
/**
- * Created by antonio on 1/30/16.
+ * A GeoJSON object with the type "FeatureCollection" is a feature object which represents a
+ * collection of feature objects.
+ *
+ * @see Official GeoJSON FeatureCollection Specifications
*/
public class FeatureCollection implements GeoJSON {
private final String type = "FeatureCollection";
private final List features;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param features List of {@link Feature}.
*/
-
private FeatureCollection(List features) {
this.features = features;
}
- /*
- * Getters
+ /**
+ * Should always be "FeatureCollection".
+ *
+ * @return String "FeatureCollection".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the List containing all the features within collection.
+ *
+ * @return List of features within collection.
+ */
public List getFeatures() {
return features;
}
- /*
- * Factories
+ /**
+ * Create a {@link FeatureCollection} from a List of features.
+ *
+ * @param features List of {@link Feature}
+ * @return new {@link FeatureCollection}
*/
-
public static FeatureCollection fromFeatures(List features) {
return new FeatureCollection(features);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON feature collection object from JSON.
+ *
+ * @param json String of JSON making up a feature collection.
+ * @return {@link FeatureCollection} GeoJSON object.
*/
-
public static FeatureCollection fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
@@ -56,11 +70,15 @@ public static FeatureCollection fromJson(String json) {
return gson.create().fromJson(json, FeatureCollection.class);
}
+ /**
+ * Convert feature collection into JSON.
+ *
+ * @return String containing feature collection JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/GeoJSON.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/GeoJSON.java
index 5796de152..1a3bb3222 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/GeoJSON.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/GeoJSON.java
@@ -1,7 +1,7 @@
package com.mapbox.services.commons.geojson;
/**
- * Created by antonio on 1/30/16.
+ * Interface implemented by all GeoJSON objects, contains common fields.
*/
public interface GeoJSON {
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Geometry.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Geometry.java
index 6cef452c3..72133f4c8 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Geometry.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Geometry.java
@@ -1,7 +1,8 @@
package com.mapbox.services.commons.geojson;
/**
- * Created by antonio on 1/30/16.
+ * Interface implemented by all Geometry objects, contains common fields.
+ * @param the type of the coordinates, normally a list interface of positions.
*/
public interface Geometry extends com.mapbox.services.commons.geojson.GeoJSON {
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/GeometryCollection.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/GeometryCollection.java
index 57ec58eb7..62bf9ac23 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/GeometryCollection.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/GeometryCollection.java
@@ -9,46 +9,60 @@
import java.util.List;
/**
- * Created by antonio on 1/30/16.
+ * A GeoJSON object with the type "GeometryCollection" is a geometry object which represents a
+ * collection of geometry objects.
+ *
+ * @see Official GeoJSON GeometryCollection Specifications
*/
-public class GeometryCollection implements com.mapbox.services.commons.geojson.GeoJSON {
+public class GeometryCollection implements GeoJSON {
private final String type = "GeometryCollection";
private final List geometries;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param geometries List of {@link Geometry}.
*/
-
public GeometryCollection(List geometries) {
this.geometries = geometries;
}
- /*
- * Getters
+ /**
+ * Should always be "GeometryCollection".
+ *
+ * @return String "GeometryCollection".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the List containing all the geometries within collection.
+ *
+ * @return List of geometries within collection.
+ */
public List getGeometries() {
return geometries;
}
- /*
- * Factories
+ /**
+ * Create a {@link GeometryCollection} from a List of geometries.
+ *
+ * @param geometries List of {@link Geometry}
+ * @return new {@link GeometryCollection}
*/
-
public static GeometryCollection fromGeometries(List geometries) {
return new GeometryCollection(geometries);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON geometry collection object from JSON.
+ *
+ * @param json String of JSON making up a geometry collection.
+ * @return {@link GeometryCollection} GeoJSON object.
*/
-
public static GeometryCollection fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
@@ -56,11 +70,15 @@ public static GeometryCollection fromJson(String json) {
return gson.create().fromJson(json, GeometryCollection.class);
}
+ /**
+ * Convert geometry collection into JSON.
+ *
+ * @return String containing geometry collection JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/LineString.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/LineString.java
index d594ee53b..5d908ddec 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/LineString.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/LineString.java
@@ -9,53 +9,71 @@
import java.util.List;
/**
- * Created by antonio on 1/30/16.
+ * A LineString is a type of {@link Geometry}.
+ *
+ * @see Official GeoJSON LineString Specifications
*/
-public class LineString implements com.mapbox.services.commons.geojson.Geometry> {
+public class LineString implements Geometry> {
private final String type = "LineString";
private final List coordinates;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param coordinates List of {@link Position} making up the LineString.
*/
-
private LineString(List coordinates) {
this.coordinates = coordinates;
}
- /*
- * Getters
+ /**
+ * Should always be "LineString".
+ *
+ * @return String "LineString".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the list of {@link Position} making up the LineString.
+ *
+ * @return List of {@link Position}.
+ */
@Override
public List getCoordinates() {
return coordinates;
}
- /*
- * Factories
+ /**
+ * creates a {@link LineString} from a list of coordinates.
+ *
+ * @param coordinates List of {@link Position} coordinates.
+ * @return {@link LineString}.
*/
-
public static LineString fromCoordinates(List coordinates) {
return new LineString(coordinates);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON LineString object from JSON.
+ *
+ * @param json String of JSON making up a LineString.
+ * @return {@link LineString} GeoJSON object.
*/
-
public static LineString fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
return gson.create().fromJson(json, LineString.class);
}
+ /**
+ * Convert feature into JSON.
+ *
+ * @return String containing LineString JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
@@ -63,10 +81,13 @@ public String toJson() {
return gson.create().toJson(this);
}
- /*
- * Polyline utils
+ /**
+ * Convert a polyline into a LineString.
+ *
+ * @param polyline String describing a polyline.
+ * @param precision The encoded precision, for example Constants.OSRM_PRECISION_V4.
+ * @return
*/
-
public static LineString fromPolyline(String polyline, int precision) {
return new LineString(PolylineUtils.decode(polyline, precision));
}
@@ -74,5 +95,4 @@ public static LineString fromPolyline(String polyline, int precision) {
public String toPolyline(int precision) {
return PolylineUtils.encode(getCoordinates(), precision);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiLineString.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiLineString.java
index 3e3f892d0..5c8c7f53e 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiLineString.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiLineString.java
@@ -8,58 +8,75 @@
import java.util.List;
/**
- * Created by antonio on 1/30/16.
+ * A MultiLineString is a type of {@link Geometry}.
+ *
+ * @see Official GeoJSON MultiLineString Specifications
*/
-public class MultiLineString implements com.mapbox.services.commons.geojson.Geometry>> {
+public class MultiLineString implements Geometry>> {
private final String type = "MultiLineString";
private final List> coordinates;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param coordinates List of {@link Position} making up the MultiLineString.
*/
-
private MultiLineString(List> coordinates) {
this.coordinates = coordinates;
}
- /*
- * Getters
+ /**
+ * Should always be "MultiLineString".
+ *
+ * @return String "MultiLineString".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the list of {@link Position} making up the MultiLineString.
+ *
+ * @return List of {@link Position}.
+ */
@Override
public List> getCoordinates() {
return coordinates;
}
- /*
- * Factories
+ /**
+ * Creates a {@link MultiLineString} from a list of coordinates.
+ *
+ * @param coordinates List of {@link Position} coordinates.
+ * @return {@link MultiLineString}.
*/
-
public static MultiLineString fromCoordinates(List> coordinates) {
return new MultiLineString(coordinates);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON MultiLineString object from JSON.
+ *
+ * @param json String of JSON making up a MultiLineString.
+ * @return {@link MultiLineString} GeoJSON object.
*/
-
public static MultiLineString fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
return gson.create().fromJson(json, MultiLineString.class);
}
+ /**
+ * Convert feature into JSON.
+ *
+ * @return String containing MultiLineString JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiPoint.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiPoint.java
index a57e033b9..ccdd68225 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiPoint.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiPoint.java
@@ -8,58 +8,75 @@
import java.util.List;
/**
- * Created by antonio on 1/30/16.
+ * A MultiPoint is a type of {@link Geometry}.
+ *
+ * @see Official GeoJSON MultiPoint Specifications
*/
-public class MultiPoint implements com.mapbox.services.commons.geojson.Geometry> {
+public class MultiPoint implements Geometry> {
private final String type = "MultiPoint";
private final List coordinates;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param coordinates List of {@link Position} making up the MultiPoint.
*/
-
private MultiPoint(List coordinates) {
this.coordinates = coordinates;
}
- /*
- * Getters
+ /**
+ * Should always be "MultiPoint".
+ *
+ * @return String "MultiPoint".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the list of {@link Position} making up the MultiPoint.
+ *
+ * @return List of {@link Position}.
+ */
@Override
public List getCoordinates() {
return coordinates;
}
- /*
- * Factories
+ /**
+ * Creates a {@link MultiPoint} from a list of coordinates.
+ *
+ * @param coordinates List of {@link Position} coordinates.
+ * @return {@link MultiPoint}.
*/
-
public static MultiPoint fromCoordinates(List coordinates) {
return new MultiPoint(coordinates);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON MultiPoint object from JSON.
+ *
+ * @param json String of JSON making up a MultiPoint.
+ * @return {@link MultiPoint} GeoJSON object.
*/
-
public static MultiPoint fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
return gson.create().fromJson(json, MultiPoint.class);
}
+ /**
+ * Convert feature into JSON.
+ *
+ * @return String containing MultiPoint JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiPolygon.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiPolygon.java
index 6cef29102..7adfc9e57 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiPolygon.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/MultiPolygon.java
@@ -8,58 +8,75 @@
import java.util.List;
/**
- * Created by antonio on 1/30/16.
+ * A MultiPolygon is a type of {@link Geometry}.
+ *
+ * @see Official GeoJSON MultiPolygon Specifications
*/
-public class MultiPolygon implements com.mapbox.services.commons.geojson.Geometry>>> {
+public class MultiPolygon implements Geometry>>> {
private final String type = "MultiPolygon";
private final List>> coordinates;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param coordinates List of {@link Position} making up the MultiPolygon.
*/
-
private MultiPolygon(List>> coordinates) {
this.coordinates = coordinates;
}
- /*
- * Getters
+ /**
+ * Should always be "MultiPolygon".
+ *
+ * @return String "MultiPolygon".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the list of {@link Position} making up the MultiPolygon.
+ *
+ * @return List of {@link Position}.
+ */
@Override
public List>> getCoordinates() {
return coordinates;
}
- /*
- * Factories
+ /**
+ * Creates a {@link MultiPolygon} from a list of coordinates.
+ *
+ * @param coordinates List of {@link Position} coordinates.
+ * @return {@link MultiPolygon}.
*/
-
public static MultiPolygon fromCoordinates(List>> coordinates) {
return new MultiPolygon(coordinates);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON MultiPolygon object from JSON.
+ *
+ * @param json String of JSON making up a MultiPolygon.
+ * @return {@link MultiPolygon} GeoJSON object.
*/
-
public static MultiPolygon fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
return gson.create().fromJson(json, MultiPolygon.class);
}
+ /**
+ * Convert feature into JSON.
+ *
+ * @return String containing MultiPolygon JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Point.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Point.java
index c8bd2b2e9..8fb33cb34 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Point.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Point.java
@@ -6,58 +6,75 @@
import com.mapbox.services.commons.models.Position;
/**
- * Created by antonio on 1/30/16.
+ * A Point is a type of {@link Geometry}.
+ *
+ * @see Official GeoJSON Point Specifications
*/
-public class Point implements com.mapbox.services.commons.geojson.Geometry {
+public class Point implements Geometry {
private final String type = "Point";
private final Position coordinates;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param coordinates {@link Position} making up the Point.
*/
-
private Point(Position coordinates) {
this.coordinates = coordinates;
}
- /*
- * Getters
+ /**
+ * Should always be "Point".
+ *
+ * @return String "Point".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the {@link Position} making up the Point.
+ *
+ * @return {@link Position} making up the Point.
+ */
@Override
public Position getCoordinates() {
return coordinates;
}
- /*
- * Factories
+ /**
+ * Creates a {@link Point} from a given coordinate.
+ *
+ * @param coordinates {@link Position} where point should be located.
+ * @return {@link Point}.
*/
-
public static Point fromCoordinates(Position coordinates) {
return new Point(coordinates);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON Point object from JSON.
+ *
+ * @param json String of JSON making up a Point.
+ * @return {@link Point} GeoJSON object.
*/
-
public static Point fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
return gson.create().fromJson(json, Point.class);
}
+ /**
+ * Convert feature into JSON.
+ *
+ * @return String containing Point JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Polygon.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Polygon.java
index 4e2302031..16001393e 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Polygon.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/Polygon.java
@@ -8,58 +8,75 @@
import java.util.List;
/**
- * Created by antonio on 1/30/16.
+ * A Polygon is a type of {@link Geometry}.
+ *
+ * @see Official GeoJSON Polygon Specifications
*/
-public class Polygon implements com.mapbox.services.commons.geojson.Geometry>> {
+public class Polygon implements Geometry>> {
private final String type = "Polygon";
private final List> coordinates;
- /*
- * Private constructor
+ /**
+ * Private constructor.
+ *
+ * @param coordinates List of {@link Position} making up the Polygon.
*/
-
private Polygon(List> coordinates) {
this.coordinates = coordinates;
}
- /*
- * Getters
+ /**
+ * Should always be "Polygon".
+ *
+ * @return String "Polygon".
*/
-
@Override
public String getType() {
return type;
}
+ /**
+ * Get the list of {@link Position} making up the Polygon.
+ *
+ * @return List of {@link Position}.
+ */
@Override
public List> getCoordinates() {
return coordinates;
}
- /*
- * Factories
+ /**
+ * Creates a {@link Polygon} from a list of coordinates.
+ *
+ * @param coordinates List of {@link Position} coordinates.
+ * @return {@link Polygon}.
*/
-
public static Polygon fromCoordinates(List> coordinates) {
return new Polygon(coordinates);
}
- /*
- * Gson interface
+ /**
+ * Create a GeoJSON Polygon object from JSON.
+ *
+ * @param json String of JSON making up a Polygon.
+ * @return {@link Polygon} GeoJSON object.
*/
-
public static Polygon fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionDeserializer());
return gson.create().fromJson(json, Polygon.class);
}
+ /**
+ * Convert feature into JSON.
+ *
+ * @return String containing Polygon JSON.
+ */
@Override
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}
-
}
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/GeometryDeserializer.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/GeometryDeserializer.java
index 7f3b3b409..2cf77a170 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/GeometryDeserializer.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/GeometryDeserializer.java
@@ -9,9 +9,9 @@
import java.lang.reflect.Type;
/**
- * Required to handle the "Unable to invoke no-args constructor for interface
- * com.mapbox.services.commons.geojson.Geometry" error that Gson shows when trying to deserialize
- * a List. There must be a better way to handle this case.
+ * Required to handle the "Unable to invoke no-args constructor for interface {@link Geometry} error
+ * that Gson shows when trying to deserialize a List. There must be a better way to handle
+ * this case.
*/
public class GeometryDeserializer implements JsonDeserializer {
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/PositionDeserializer.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/PositionDeserializer.java
index 28af4d1fd..9f58c30d6 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/PositionDeserializer.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/PositionDeserializer.java
@@ -10,8 +10,8 @@
import java.lang.reflect.Type;
/**
- * Required to handle the "Expected BEGIN_OBJECT but was BEGIN_ARRAY" error
- * that Gson would show otherwise.
+ * Required to handle the "Expected BEGIN_OBJECT but was BEGIN_ARRAY" error that Gson would show
+ * otherwise.
*/
public class PositionDeserializer implements JsonDeserializer {
diff --git a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/PositionSerializer.java b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/PositionSerializer.java
index a01b1ea61..4c6965a04 100644
--- a/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/PositionSerializer.java
+++ b/libjava/lib/src/main/java/com/mapbox/services/commons/geojson/custom/PositionSerializer.java
@@ -10,8 +10,8 @@
import java.lang.reflect.Type;
/**
- * Required to handle the special case where the altitude might be a Double.NaN,
- * which isn't a valid double value as per JSON specification.
+ * Required to handle the special case where the altitude might be a Double.NaN, which isn't a valid
+ * double value as per JSON specification.
*/
public class PositionSerializer implements JsonSerializer {