Search in sources :

Example 1 with ObjectCodec

use of com.fasterxml.jackson.core.ObjectCodec in project spring-boot by spring-projects.

the class JsonObjectDeserializer method deserialize.

@Override
public final T deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    try {
        ObjectCodec codec = jp.getCodec();
        JsonNode tree = codec.readTree(jp);
        return deserializeObject(jp, ctxt, codec, tree);
    } catch (Exception ex) {
        if (ex instanceof IOException) {
            throw (IOException) ex;
        }
        throw new JsonMappingException(jp, "Object deserialize error", ex);
    }
}
Also used : JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectCodec(com.fasterxml.jackson.core.ObjectCodec) IOException(java.io.IOException) IOException(java.io.IOException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Example 2 with ObjectCodec

use of com.fasterxml.jackson.core.ObjectCodec in project Gaffer by gchq.

the class StatusDeserialiser method deserialize.

@SuppressFBWarnings("DM_CONVERT_CASE")
@Override
public Status deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
    final ObjectCodec codec = jsonParser.getCodec();
    final JsonNode node = codec.readTree(jsonParser);
    final String statusStr = node.asText().toUpperCase().replace(' ', '_');
    return Status.valueOf(statusStr);
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectCodec(com.fasterxml.jackson.core.ObjectCodec) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 3 with ObjectCodec

use of com.fasterxml.jackson.core.ObjectCodec in project shifu by ShifuML.

the class PostCorrelationMetricDeserializer method deserialize.

/*
     * (non-Javadoc)
     * 
     * @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser,
     * com.fasterxml.jackson.databind.DeserializationContext)
     */
@Override
public PostCorrelationMetric deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    ObjectCodec oc = jp.getCodec();
    JsonNode node = oc.readTree(jp);
    for (PostCorrelationMetric value : PostCorrelationMetric.values()) {
        if (value.name().equalsIgnoreCase(node.textValue())) {
            return value;
        }
    }
    return null;
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectCodec(com.fasterxml.jackson.core.ObjectCodec) PostCorrelationMetric(ml.shifu.shifu.container.obj.ModelVarSelectConf.PostCorrelationMetric)

Example 4 with ObjectCodec

use of com.fasterxml.jackson.core.ObjectCodec in project shifu by ShifuML.

the class BinningMethodDeserializer method deserialize.

@Override
public BinningMethod deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    ObjectCodec oc = jp.getCodec();
    JsonNode node = oc.readTree(jp);
    for (BinningMethod value : BinningMethod.values()) {
        if (value.name().equalsIgnoreCase(node.textValue())) {
            return value;
        }
    }
    return null;
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectCodec(com.fasterxml.jackson.core.ObjectCodec) BinningMethod(ml.shifu.shifu.container.obj.ModelStatsConf.BinningMethod)

Example 5 with ObjectCodec

use of com.fasterxml.jackson.core.ObjectCodec in project shifu by ShifuML.

the class CorrelationDeserializer method deserialize.

/*
     * (non-Javadoc)
     * 
     * @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser,
     * com.fasterxml.jackson.databind.DeserializationContext)
     */
@Override
public Correlation deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    ObjectCodec oc = jp.getCodec();
    JsonNode node = oc.readTree(jp);
    for (Correlation value : Correlation.values()) {
        if (value.name().equalsIgnoreCase(node.textValue())) {
            return value;
        }
    }
    return null;
}
Also used : Correlation(ml.shifu.shifu.container.obj.ModelNormalizeConf.Correlation) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectCodec(com.fasterxml.jackson.core.ObjectCodec)

Aggregations

ObjectCodec (com.fasterxml.jackson.core.ObjectCodec)18 JsonNode (com.fasterxml.jackson.databind.JsonNode)15 ArrayList (java.util.ArrayList)2 JsonParser (com.fasterxml.jackson.core.JsonParser)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)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 Correlation (ml.shifu.shifu.container.obj.ModelNormalizeConf.Correlation)1