in src/main/java/org/opensearch/geospatial/geojson/FeatureFactory.java [36:58]
private static FeatureBuilder extractFeature(Map<String, Object> input) {
Object geometry = input.get(Feature.GEOMETRY_KEY);
if (geometry == null) {
throw new IllegalArgumentException("key: " + Feature.GEOMETRY_KEY + " cannot be null");
}
if (!(geometry instanceof Map)) {
throw new IllegalArgumentException(
"key: " + Feature.GEOMETRY_KEY + " is not an instance of type Map but of type [ " + geometry.getClass().getName() + " ]"
);
}
Map<String, Object> geometryMap = toStringObjectMap(geometry);
FeatureBuilder featureBuilder = new FeatureBuilder(geometryMap);
Object properties = input.get(Feature.PROPERTIES_KEY);
if (properties == null) {
return featureBuilder;
}
if (!(properties instanceof Map)) {
throw new IllegalArgumentException(
"key: " + Feature.PROPERTIES_KEY + " is not an instance of type Map but of type [ " + properties.getClass().getName() + " ]"
);
}
return featureBuilder.properties(toStringObjectMap(properties));
}