Search in sources :

Example 21 with ObjectCodec

use of com.fasterxml.jackson.core.ObjectCodec in project oc-explorer by devgateway.

the class GeoJsonPointDeserializer method deserialize.

@Override
public GeoJsonPoint deserialize(final JsonParser jsonParser, final DeserializationContext ctxt) throws IOException {
    ObjectCodec objectCodec = jsonParser.getCodec();
    JsonNode jsonNode = objectCodec.readTree(jsonParser);
    ArrayNode coordinate = (ArrayNode) jsonNode.get("coordinates");
    return new GeoJsonPoint(coordinate.get(0).asDouble(), coordinate.get(1).asDouble());
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectCodec(com.fasterxml.jackson.core.ObjectCodec) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) GeoJsonPoint(org.springframework.data.mongodb.core.geo.GeoJsonPoint)

Aggregations

ObjectCodec (com.fasterxml.jackson.core.ObjectCodec)21 JsonNode (com.fasterxml.jackson.databind.JsonNode)18 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 ArrayList (java.util.ArrayList)2 GeoJsonPoint (org.springframework.data.mongodb.core.geo.GeoJsonPoint)2 JsonParser (com.fasterxml.jackson.core.JsonParser)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 DefaultSerializerProvider (com.fasterxml.jackson.databind.ser.DefaultSerializerProvider)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 IAE (io.druid.java.util.common.IAE)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1 URI (java.net.URI)1 X509Certificate (java.security.cert.X509Certificate)1 List (java.util.List)1 SSLContext (javax.net.ssl.SSLContext)1 RunMode (ml.shifu.shifu.container.obj.ModelBasicConf.RunMode)1