com.fasterxml.jackson.databind.DeserializationContext#getContextualType ( )源码实例Demo

下面列出了com.fasterxml.jackson.databind.DeserializationContext#getContextualType ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
	BeanProperty property) {
	JavaType contextualType = ctxt.getContextualType();
	checkArgument(contextualType.isEnumType());
	return createFromType(contextualType);
}
 
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
	BeanProperty property) {
	JavaType contextualType = ctxt.getContextualType();
	checkArgument(contextualType.isEnumType());
	return createFromType(contextualType);
}
 
源代码3 项目: graphql-spqr   文件: ConvertingDeserializer.java
@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);
    }
}
 
源代码4 项目: gwt-jackson   文件: RefStdDeserializer.java
@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 ) );
}
 
源代码5 项目: gwt-jackson   文件: RefStdKeyDeserializer.java
@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 ) );
}
 
源代码6 项目: bazel-tools   文件: TableDeserializer.java
@Override
public JsonDeserializer<?> createContextual(
    final DeserializationContext deserializationContext, final BeanProperty beanProperty)
    throws JsonMappingException {
  return new TableDeserializer(deserializationContext.getContextualType());
}