use of com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer in project jackson-databind by FasterXML.
the class DeserializationContext method findRootValueDeserializer.
/**
* Method for finding a deserializer for root-level value.
*/
@SuppressWarnings("unchecked")
public final JsonDeserializer<Object> findRootValueDeserializer(JavaType type) throws JsonMappingException {
JsonDeserializer<Object> deser = _cache.findValueDeserializer(this, _factory, type);
if (deser == null) {
// can this occur?
return null;
}
deser = (JsonDeserializer<Object>) handleSecondaryContextualization(deser, null, type);
TypeDeserializer typeDeser = _factory.findTypeDeserializer(_config, type);
if (typeDeser != null) {
// important: contextualize to indicate this is for root value
typeDeser = typeDeser.forProperty(null);
return new TypeWrappedDeserializer(typeDeser, deser);
}
return deser;
}
use of com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer in project beam by apache.
the class PipelineOptionsFactory method computeDeserializerForMethod.
private static JsonDeserializer<Object> computeDeserializerForMethod(Method method) {
try {
BeanProperty prop = createBeanProperty(method);
AnnotatedMember annotatedMethod = prop.getMember();
DefaultDeserializationContext context = DESERIALIZATION_CONTEXT.get();
Object maybeDeserializerClass = context.getAnnotationIntrospector().findDeserializer(annotatedMethod);
JsonDeserializer<Object> jsonDeserializer = context.deserializerInstance(annotatedMethod, maybeDeserializerClass);
if (jsonDeserializer == null) {
jsonDeserializer = context.findContextualValueDeserializer(prop.getType(), prop);
}
TypeDeserializer typeDeserializer = context.getFactory().findTypeDeserializer(context.getConfig(), prop.getType());
if (typeDeserializer != null) {
jsonDeserializer = new TypeWrappedDeserializer(typeDeserializer, jsonDeserializer);
}
return jsonDeserializer;
} catch (JsonMappingException e) {
throw new RuntimeException(e);
}
}
Aggregations