本文整理汇总了Java中com.fasterxml.jackson.databind.annotation.JsonTypeResolver类的典型用法代码示例。如果您正苦于以下问题:Java JsonTypeResolver类的具体用法?Java JsonTypeResolver怎么用?Java JsonTypeResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonTypeResolver类属于com.fasterxml.jackson.databind.annotation包,在下文中一共展示了JsonTypeResolver类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _findTypeResolver
import com.fasterxml.jackson.databind.annotation.JsonTypeResolver; //导入依赖的package包/类
protected TypeResolverBuilder<?> _findTypeResolver(MapperConfig<?> paramMapperConfig, Annotated paramAnnotated, JavaType paramJavaType)
{
JsonTypeInfo localJsonTypeInfo = (JsonTypeInfo)paramAnnotated.getAnnotation(JsonTypeInfo.class);
JsonTypeResolver localJsonTypeResolver = (JsonTypeResolver)paramAnnotated.getAnnotation(JsonTypeResolver.class);
Object localObject;
if (localJsonTypeResolver != null)
{
if (localJsonTypeInfo == null)
return null;
localObject = paramMapperConfig.typeResolverBuilderInstance(paramAnnotated, localJsonTypeResolver.value());
}
else
{
if (localJsonTypeInfo == null)
return null;
if (localJsonTypeInfo.use() == JsonTypeInfo.Id.NONE)
return _constructNoTypeResolverBuilder();
localObject = _constructStdTypeResolverBuilder();
}
JsonTypeIdResolver localJsonTypeIdResolver = (JsonTypeIdResolver)paramAnnotated.getAnnotation(JsonTypeIdResolver.class);
TypeIdResolver localTypeIdResolver1;
if (localJsonTypeIdResolver == null)
localTypeIdResolver1 = null;
else
localTypeIdResolver1 = paramMapperConfig.typeIdResolverInstance(paramAnnotated, localJsonTypeIdResolver.value());
TypeIdResolver localTypeIdResolver2 = localTypeIdResolver1;
if (localTypeIdResolver1 != null)
localTypeIdResolver2.init(paramJavaType);
TypeResolverBuilder localTypeResolverBuilder1 = ((TypeResolverBuilder)localObject).init(localJsonTypeInfo.use(), localTypeIdResolver2);
JsonTypeInfo.As localAs1 = localJsonTypeInfo.include();
JsonTypeInfo.As localAs2 = localAs1;
if ((localAs1 == JsonTypeInfo.As.EXTERNAL_PROPERTY) && ((paramAnnotated instanceof AnnotatedClass)))
localAs2 = JsonTypeInfo.As.PROPERTY;
TypeResolverBuilder localTypeResolverBuilder2 = localTypeResolverBuilder1.inclusion(localAs2).typeProperty(localJsonTypeInfo.property());
Class localClass = localJsonTypeInfo.defaultImpl();
if (localClass != JsonTypeInfo.None.class)
localTypeResolverBuilder2 = localTypeResolverBuilder2.defaultImpl(localClass);
return localTypeResolverBuilder2.typeIdVisibility(localJsonTypeInfo.visible());
}