当前位置: 首页>>代码示例>>Java>>正文


Java TypeResolverBuilder.buildTypeSerializer方法代码示例

本文整理汇总了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);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:20,代码来源:BasicSerializerFactory.java

示例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);
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:26,代码来源:BeanSerializerFactory.java

示例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);
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:28,代码来源:BasicSerializerFactory.java

示例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));
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:10,代码来源:BeanSerializerFactory.java

示例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));
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:9,代码来源:BeanSerializerFactory.java

示例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);
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:25,代码来源:BeanSerializerFactory.java


注:本文中的com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder.buildTypeSerializer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。