use of com.fasterxml.jackson.databind.node.ObjectNode in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedSetterWithDefaultDeserialization.
@Test
public void testAnnotatedSetterWithDefaultDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedSetterWithDefault", expected);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedSetterWithDefault().getStringProperty()).isEqualTo("value");
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedSetterWithDefaultNullDeserialization.
@Test
public void testAnnotatedSetterWithDefaultNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedSetterWithDefault", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedSetterWithDefault().getStringProperty()).isEqualTo("value");
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project series-rest-api by 52North.
the class GeoJSONEncoder method encode.
protected ObjectNode encode(Point geometry, int parentSrid) {
ObjectNode json = jsonFactory.objectNode();
json.put(JSONConstants.TYPE, JSONConstants.POINT);
json.set(JSONConstants.COORDINATES, encodeCoordinates(geometry));
encodeCRS(json, geometry, parentSrid);
return json;
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project series-rest-api by 52North.
the class GeoJSONEncoder method encode.
protected ObjectNode encode(MultiPolygon geometry, int parentSrid) {
ObjectNode json = jsonFactory.objectNode();
ArrayNode list = json.put(JSONConstants.TYPE, JSONConstants.MULTI_POLYGON).putArray(JSONConstants.COORDINATES);
for (int i = 0; i < geometry.getNumGeometries(); ++i) {
list.add(encodeCoordinates((Polygon) geometry.getGeometryN(i)));
}
encodeCRS(json, geometry, parentSrid);
return json;
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project series-rest-api by 52North.
the class GeoJSONEncoder method encode.
protected ObjectNode encode(Polygon geometry, int parentSrid) {
ObjectNode json = jsonFactory.objectNode();
json.put(JSONConstants.TYPE, JSONConstants.POLYGON);
json.set(JSONConstants.COORDINATES, encodeCoordinates(geometry));
encodeCRS(json, geometry, parentSrid);
return json;
}
Aggregations