use of com.fasterxml.jackson.core.ObjectCodec in project shifu by ShifuML.
the class MultipleClassificationDeserializer method deserialize.
/*
* (non-Javadoc)
*
* @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser,
* com.fasterxml.jackson.databind.DeserializationContext)
*/
@Override
public MultipleClassification deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
ObjectCodec oc = jp.getCodec();
JsonNode node = oc.readTree(jp);
for (MultipleClassification value : MultipleClassification.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 NormTypeDeserializer method deserialize.
/*
* (non-Javadoc)
*
* @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser,
* com.fasterxml.jackson.databind.DeserializationContext)
*/
@Override
public NormType deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
ObjectCodec oc = jp.getCodec();
JsonNode node = oc.readTree(jp);
for (NormType value : NormType.values()) {
if (value.name().equalsIgnoreCase(node.textValue())) {
return value;
}
}
return null;
}
use of com.fasterxml.jackson.core.ObjectCodec in project cas by apereo.
the class X509CertificateCredentialJsonDeserializer method deserialize.
@Override
public X509CertificateCredential deserialize(final JsonParser jp, final DeserializationContext deserializationContext) throws IOException {
final ObjectCodec oc = jp.getCodec();
final JsonNode node = oc.readTree(jp);
final List<X509Certificate> certs = new ArrayList<>();
node.findValues("certificates").forEach(n -> {
final String cert = n.get(0).textValue();
final byte[] data = EncodingUtils.decodeBase64(cert);
certs.add(CertUtils.readCertificate(new InputStreamResource(new ByteArrayInputStream(data))));
});
final X509CertificateCredential c = new X509CertificateCredential(certs.toArray(new X509Certificate[] {}));
return c;
}
use of com.fasterxml.jackson.core.ObjectCodec in project ocvn 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());
}
use of com.fasterxml.jackson.core.ObjectCodec in project CzechIdMng by bcvsolutions.
the class GuardedStringDeserializer method deserialize.
/**
* {@inheritDoc}
*/
@Override
public GuardedString deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException {
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
return new GuardedString(node.asText());
}
Aggregations