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);
}
}
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);
}
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;
}
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;
}
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;
}
Aggregations