Closed
Description
Paolo opened DATAMONGO-1399 and commented
GeoJsonPolygon cannot have holes.
The only accessor to private field "coordinates" is the following
@Override
public List<GeoJsonLineString> getCoordinates() {
return Collections.unmodifiableList(this.coordinates);
}
So, after construction (below the constructor) there is no way to add other GeoJsonLineString for holes.
public GeoJsonPolygon(List<Point> points) {
super(points);
this.coordinates.add(new GeoJsonLineString(points));
}
WORKAROUND
Using Reflection...
Field f = result.getClass().getDeclaredField("coordinates");
f.setAccessible(true);
List<GeoJsonLineString> coordinates = (List<GeoJsonLineString>) f.get(result);
coordinates.add(new GeoJsonLineString(...));
This works, but it's an horrible workaround!!!
Affects: 1.8 GA (Gosling)
Referenced from: pull request #352