Java Code Examples for com.fasterxml.jackson.databind.DeserializationContext#getContextualType()
The following examples show how to use
com.fasterxml.jackson.databind.DeserializationContext#getContextualType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnumNameDeserializer.java From metanome-algorithms with Apache License 2.0 | 5 votes |
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) { JavaType contextualType = ctxt.getContextualType(); checkArgument(contextualType.isEnumType()); return createFromType(contextualType); }
Example 2
Source File: SingletonDeserializer.java From metanome-algorithms with Apache License 2.0 | 5 votes |
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) { JavaType contextualType = ctxt.getContextualType(); checkArgument(contextualType.isEnumType()); return createFromType(contextualType); }
Example 3
Source File: ConvertingDeserializer.java From graphql-spqr with Apache License 2.0 | 5 votes |
@Override public JsonDeserializer<?> createContextual(DeserializationContext deserializationContext, BeanProperty beanProperty) { JavaType javaType = deserializationContext.getContextualType() != null ? deserializationContext.getContextualType() : extractType(beanProperty.getMember()); Annotation[] annotations = annotations(beanProperty); AnnotatedType detectedType = environment.typeTransformer.transform(ClassUtils.addAnnotations(TypeUtils.toJavaType(javaType), annotations)); JavaType substituteType = deserializationContext.getTypeFactory().constructType(environment.getMappableInputType(detectedType).getType()); if (inputConverter.supports(detectedType)) { return new ConvertingDeserializer(detectedType, substituteType, inputConverter, environment, objectMapper); } else { return new DefaultDeserializer(javaType); } }
Example 4
Source File: RefStdDeserializer.java From gwt-jackson with Apache License 2.0 | 5 votes |
@Override public JsonDeserializer<?> createContextual( DeserializationContext ctxt, BeanProperty property ) throws JsonMappingException { if ( ctxt.getContextualType() == null || ctxt.getContextualType().containedType( 0 ) == null ) { throw JsonMappingException.from( ctxt, "Cannot deserialize Ref<T>. Cannot find the Generic Type T." ); } return new RefStdDeserializer( ctxt.getContextualType().containedType( 0 ) ); }
Example 5
Source File: RefStdKeyDeserializer.java From gwt-jackson with Apache License 2.0 | 5 votes |
@Override public KeyDeserializer createContextual( DeserializationContext ctxt, BeanProperty property ) throws JsonMappingException { if ( ctxt.getContextualType() == null || ctxt.getContextualType().containedType( 0 ) == null || ctxt.getContextualType().containedType( 0 ).containedType( 0 ) == null ) { throw JsonMappingException.from( ctxt, "Cannot deserialize Ref<T>. Cannot find the Generic Type T." ); } return new RefStdKeyDeserializer( ctxt.getContextualType().containedType( 0 ).containedType( 0 ) ); }
Example 6
Source File: TableDeserializer.java From bazel-tools with Apache License 2.0 | 4 votes |
@Override public JsonDeserializer<?> createContextual( final DeserializationContext deserializationContext, final BeanProperty beanProperty) throws JsonMappingException { return new TableDeserializer(deserializationContext.getContextualType()); }