本文整理汇总了Java中com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder.buildTypeSerializer方法的典型用法代码示例。如果您正苦于以下问题:Java TypeResolverBuilder.buildTypeSerializer方法的具体用法?Java TypeResolverBuilder.buildTypeSerializer怎么用?Java TypeResolverBuilder.buildTypeSerializer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder
的用法示例。
在下文中一共展示了TypeResolverBuilder.buildTypeSerializer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTypeSerializer
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; //导入方法依赖的package包/类
public TypeSerializer createTypeSerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType)
{
AnnotatedClass localAnnotatedClass = paramSerializationConfig.introspectClassAnnotations(paramJavaType.getRawClass()).getClassInfo();
AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
TypeResolverBuilder localTypeResolverBuilder = localAnnotationIntrospector.findTypeResolver(paramSerializationConfig, localAnnotatedClass, paramJavaType);
Collection localCollection;
if (localTypeResolverBuilder == null)
{
localTypeResolverBuilder = paramSerializationConfig.getDefaultTyper(paramJavaType);
localCollection = null;
}
else
{
localCollection = paramSerializationConfig.getSubtypeResolver().collectAndResolveSubtypes(localAnnotatedClass, paramSerializationConfig, localAnnotationIntrospector);
}
if (localTypeResolverBuilder == null)
return null;
return localTypeResolverBuilder.buildTypeSerializer(paramSerializationConfig, paramJavaType, localCollection);
}
示例2: findPropertyContentTypeSerializer
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; //导入方法依赖的package包/类
/**
* Method called to create a type information serializer for values of given
* container property
* if one is needed. If not needed (no polymorphic handling configured), should
* return null.
*
* @param containerType Declared type of the container to use as the base type for type information serializer
*
* @return Type serializer to use for property value contents, if one is needed; null if not.
*/
public TypeSerializer findPropertyContentTypeSerializer(JavaType containerType,
SerializationConfig config, AnnotatedMember accessor)
throws JsonMappingException
{
JavaType contentType = containerType.getContentType();
AnnotationIntrospector ai = config.getAnnotationIntrospector();
TypeResolverBuilder<?> b = ai.findPropertyContentTypeResolver(config, accessor, containerType);
// Defaulting: if no annotations on member, check value class
if (b == null) {
return createTypeSerializer(config, contentType);
}
Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypes(accessor,
config, ai, contentType);
return b.buildTypeSerializer(config, contentType, subtypes);
}
示例3: createTypeSerializer
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; //导入方法依赖的package包/类
/**
* Method called to construct a type serializer for values with given declared
* base type. This is called for values other than those of bean property
* types.
*/
@Override
public TypeSerializer createTypeSerializer(SerializationConfig config,
JavaType baseType)
{
BeanDescription bean = config.introspectClassAnnotations(baseType.getRawClass());
AnnotatedClass ac = bean.getClassInfo();
AnnotationIntrospector ai = config.getAnnotationIntrospector();
TypeResolverBuilder<?> b = ai.findTypeResolver(config, ac, baseType);
/* Ok: if there is no explicit type info handler, we may want to
* use a default. If so, config object knows what to use.
*/
Collection<NamedType> subtypes = null;
if (b == null) {
b = config.getDefaultTyper(baseType);
} else {
subtypes = config.getSubtypeResolver().collectAndResolveSubtypes(ac, config, ai);
}
if (b == null) {
return null;
}
return b.buildTypeSerializer(config, baseType, subtypes);
}
示例4: findPropertyContentTypeSerializer
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; //导入方法依赖的package包/类
public TypeSerializer findPropertyContentTypeSerializer(JavaType paramJavaType, SerializationConfig paramSerializationConfig, AnnotatedMember paramAnnotatedMember)
{
JavaType localJavaType = paramJavaType.getContentType();
AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
TypeResolverBuilder localTypeResolverBuilder = localAnnotationIntrospector.findPropertyContentTypeResolver(paramSerializationConfig, paramAnnotatedMember, paramJavaType);
if (localTypeResolverBuilder == null)
return createTypeSerializer(paramSerializationConfig, localJavaType);
return localTypeResolverBuilder.buildTypeSerializer(paramSerializationConfig, localJavaType, paramSerializationConfig.getSubtypeResolver().collectAndResolveSubtypes(paramAnnotatedMember, paramSerializationConfig, localAnnotationIntrospector, localJavaType));
}
示例5: findPropertyTypeSerializer
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; //导入方法依赖的package包/类
public TypeSerializer findPropertyTypeSerializer(JavaType paramJavaType, SerializationConfig paramSerializationConfig, AnnotatedMember paramAnnotatedMember)
{
AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
TypeResolverBuilder localTypeResolverBuilder = localAnnotationIntrospector.findPropertyTypeResolver(paramSerializationConfig, paramAnnotatedMember, paramJavaType);
if (localTypeResolverBuilder == null)
return createTypeSerializer(paramSerializationConfig, paramJavaType);
return localTypeResolverBuilder.buildTypeSerializer(paramSerializationConfig, paramJavaType, paramSerializationConfig.getSubtypeResolver().collectAndResolveSubtypes(paramAnnotatedMember, paramSerializationConfig, localAnnotationIntrospector, paramJavaType));
}
示例6: findPropertyTypeSerializer
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; //导入方法依赖的package包/类
/**
* Method called to create a type information serializer for values of given
* non-container property
* if one is needed. If not needed (no polymorphic handling configured), should
* return null.
*
* @param baseType Declared type to use as the base type for type information serializer
*
* @return Type serializer to use for property values, if one is needed; null if not.
*/
public TypeSerializer findPropertyTypeSerializer(JavaType baseType,
SerializationConfig config, AnnotatedMember accessor)
throws JsonMappingException
{
AnnotationIntrospector ai = config.getAnnotationIntrospector();
TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(config, accessor, baseType);
// Defaulting: if no annotations on member, check value class
if (b == null) {
return createTypeSerializer(config, baseType);
}
Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypes(
accessor, config, ai, baseType);
return b.buildTypeSerializer(config, baseType, subtypes);
}