net.anwiba.spatial.geo.json.v01_0.GeoJsonObject Maven / Gradle / Ivy
//Copyright (c) 2012 by Andreas W. Bartels ([email protected])
package net.anwiba.spatial.geo.json.v01_0;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(FeatureCollection.class),
@JsonSubTypes.Type(Feature.class),
@JsonSubTypes.Type(Geometry.class),
@JsonSubTypes.Type(Point.class),
@JsonSubTypes.Type(LineString.class),
@JsonSubTypes.Type(Polygon.class),
@JsonSubTypes.Type(MultiPoint.class),
@JsonSubTypes.Type(MultiLineString.class),
@JsonSubTypes.Type(MultiPolygon.class),
@JsonSubTypes.Type(GeometryCollection.class)
})
public class GeoJsonObject {
private Crs crs = null;
private double[] bbox = null;
private final Map _unknownMembers = new LinkedHashMap();
@JsonProperty("crs")
public void setCrs(final Crs crs) {
this.crs = crs;
}
@JsonProperty("crs")
public Crs getCrs() {
return this.crs;
}
@JsonProperty("bbox")
public void setBbox(final double[] bbox) {
this.bbox = bbox;
}
@JsonProperty("bbox")
public double[] getBbox() {
return this.bbox;
}
@JsonAnySetter
public void set(final String name, final Object value) {
Objects.requireNonNull(name);
this._unknownMembers.put(name, value);
}
@JsonAnyGetter
public Map get() {
if (this._unknownMembers.isEmpty()) {
return null;
}
return this._unknownMembers;
}
}