Java 类org.codehaus.jackson.map.jsontype.NamedType 实例源码

项目:12306-android-Decompile    文件:StdSubtypeResolver.java   
public Collection<NamedType> collectAndResolveSubtypes(AnnotatedClass paramAnnotatedClass, MapperConfig<?> paramMapperConfig, AnnotationIntrospector paramAnnotationIntrospector)
{
  HashMap localHashMap = new HashMap();
  if (this._registeredSubtypes != null)
  {
    Class localClass = paramAnnotatedClass.getRawType();
    Iterator localIterator = this._registeredSubtypes.iterator();
    while (localIterator.hasNext())
    {
      NamedType localNamedType = (NamedType)localIterator.next();
      if (!localClass.isAssignableFrom(localNamedType.getType()))
        continue;
      _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(localNamedType.getType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
    }
  }
  _collectAndResolve(paramAnnotatedClass, new NamedType(paramAnnotatedClass.getRawType(), null), paramMapperConfig, paramAnnotationIntrospector, localHashMap);
  return new ArrayList(localHashMap.values());
}
项目:12306-android-Decompile    文件:StdTypeResolverBuilder.java   
protected TypeIdResolver idResolver(MapperConfig<?> paramMapperConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, boolean paramBoolean1, boolean paramBoolean2)
{
  if (this._customIdResolver != null)
    return this._customIdResolver;
  if (this._idType == null)
    throw new IllegalStateException("Can not build, 'init()' not yet called");
  switch (1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$Id[this._idType.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type id resolver for idType: " + this._idType);
  case 1:
    return new ClassNameIdResolver(paramJavaType, paramMapperConfig.getTypeFactory());
  case 2:
    return new MinimalClassNameIdResolver(paramJavaType, paramMapperConfig.getTypeFactory());
  case 3:
  }
  return TypeNameIdResolver.construct(paramMapperConfig, paramJavaType, paramCollection, paramBoolean1, paramBoolean2);
}
项目:12306-android-Decompile    文件:JacksonAnnotationIntrospector.java   
public List<NamedType> findSubtypes(Annotated paramAnnotated)
{
  JsonSubTypes localJsonSubTypes = (JsonSubTypes)paramAnnotated.getAnnotation(JsonSubTypes.class);
  ArrayList localArrayList;
  if (localJsonSubTypes == null)
    localArrayList = null;
  while (true)
  {
    return localArrayList;
    JsonSubTypes.Type[] arrayOfType = localJsonSubTypes.value();
    localArrayList = new ArrayList(arrayOfType.length);
    int i = arrayOfType.length;
    for (int j = 0; j < i; j++)
    {
      JsonSubTypes.Type localType = arrayOfType[j];
      localArrayList.add(new NamedType(localType.value(), localType.name()));
    }
  }
}
项目:RHome    文件:StdTypeResolverBuilder.java   
public TypeDeserializer buildTypeDeserializer(JavaType baseType,
        Collection<NamedType> subtypes)
{
    TypeIdResolver idRes = idResolver(baseType, subtypes, false, true);

    // First, method for converting type info to type id:
    switch (_includeAs) {
    case WRAPPER_ARRAY:
        return new AsArrayTypeDeserializer(baseType, idRes);
    case PROPERTY:
        return new AsPropertyTypeDeserializer(baseType, idRes, _typeProperty);
    case WRAPPER_OBJECT:
        return new AsWrapperTypeDeserializer(baseType, idRes);
    default:
        throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: "+_includeAs);
    }
}
项目:RHome    文件:StdTypeResolverBuilder.java   
/**
 * Helper method that will either return configured custom
 * type id resolver, or construct a standard resolver
 * given configuration.
 */
protected TypeIdResolver idResolver(JavaType baseType, Collection<NamedType> subtypes,
        boolean forSer, boolean forDeser)
{
    // Custom id resolver?
    if (_customIdResolver != null) {
        return _customIdResolver;
    }
    if (_idType == null) {
        throw new IllegalStateException("Can not build, 'init()' not yet called");
    }
    switch (_idType) {
    case CLASS:
        return new ClassNameIdResolver(baseType);
    case MINIMAL_CLASS:
        return new MinimalClassNameIdResolver(baseType);
    case NAME:
        return TypeNameIdResolver.construct(baseType, subtypes, forSer, forDeser);

    case CUSTOM: // need custom resolver...
    case NONE: // hmmh. should never get this far with 'none'
    }
    throw new IllegalStateException("Do not know how to construct standard type id resolver for idType: "+_idType);
}
项目:RHome    文件:BasicSerializerFactory.java   
/**
 * 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(JavaType baseType, SerializationConfig config)
{
    BasicBeanDescription bean = config.introspectClassAnnotations(baseType.getRawClass());
    AnnotatedClass ac = bean.getClassInfo();
    AnnotationIntrospector ai = config.getAnnotationIntrospector();
    TypeResolverBuilder<?> b = ai.findTypeResolver(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 = SubTypeHelper.collectAndResolveSubtypes(ac, config, ai);
    }
    return (b == null) ? null : b.buildTypeSerializer(baseType, subtypes);
}
项目:RHome    文件:BasicDeserializerFactory.java   
@Override
public TypeDeserializer findTypeDeserializer(DeserializationConfig config, JavaType baseType)
{
    Class<?> cls = baseType.getRawClass();
    BasicBeanDescription bean = config.introspectClassAnnotations(cls);
    AnnotatedClass ac = bean.getClassInfo();
    AnnotationIntrospector ai = config.getAnnotationIntrospector();
    TypeResolverBuilder<?> b = ai.findTypeResolver(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 = SubTypeHelper.collectAndResolveSubtypes(ac, config, ai);
    }
    return (b == null) ? null : b.buildTypeDeserializer(baseType, subtypes);
}
项目:RHome    文件:SubTypeHelper.java   
/**
 * 
 * @param base Base member to use for type resolution: either annotated type (class),
 *    or property (field, getter/setter)
 */
public static List<NamedType> collectAndResolveSubtypes(Annotated base,
    MapperConfig<?> config, AnnotationIntrospector ai)
{
    // but if annotations found, may need to resolve subtypes:
    Collection<NamedType> st = ai.findSubtypes(base);
    AnnotatedClass ac = (base instanceof AnnotatedClass) ?
            (AnnotatedClass) base : null;
    // If no explicit definitions, base itself might have name
    if (st == null || st.isEmpty()) {
        if (ac != null) {
            String name = ai.findTypeName(ac);
            if (name != null) {
                ArrayList<NamedType> result = new ArrayList<NamedType>();
                result.add(new NamedType(ac.getRawType(), name));
                return result;
            }
        }
        return null;
    }
    return instance._collectAndResolve(ac, config, ai, st);
}
项目:12306-android-Decompile    文件:StdSubtypeResolver.java   
public Collection<NamedType> collectAndResolveSubtypes(AnnotatedClass paramAnnotatedClass, MapperConfig<?> paramMapperConfig, AnnotationIntrospector paramAnnotationIntrospector)
{
  HashMap localHashMap = new HashMap();
  if (this._registeredSubtypes != null)
  {
    Class localClass = paramAnnotatedClass.getRawType();
    Iterator localIterator = this._registeredSubtypes.iterator();
    while (localIterator.hasNext())
    {
      NamedType localNamedType = (NamedType)localIterator.next();
      if (!localClass.isAssignableFrom(localNamedType.getType()))
        continue;
      _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(localNamedType.getType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
    }
  }
  _collectAndResolve(paramAnnotatedClass, new NamedType(paramAnnotatedClass.getRawType(), null), paramMapperConfig, paramAnnotationIntrospector, localHashMap);
  return new ArrayList(localHashMap.values());
}
项目:12306-android-Decompile    文件:StdTypeResolverBuilder.java   
protected TypeIdResolver idResolver(MapperConfig<?> paramMapperConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, boolean paramBoolean1, boolean paramBoolean2)
{
  if (this._customIdResolver != null)
    return this._customIdResolver;
  if (this._idType == null)
    throw new IllegalStateException("Can not build, 'init()' not yet called");
  switch (1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$Id[this._idType.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type id resolver for idType: " + this._idType);
  case 1:
    return new ClassNameIdResolver(paramJavaType, paramMapperConfig.getTypeFactory());
  case 2:
    return new MinimalClassNameIdResolver(paramJavaType, paramMapperConfig.getTypeFactory());
  case 3:
  }
  return TypeNameIdResolver.construct(paramMapperConfig, paramJavaType, paramCollection, paramBoolean1, paramBoolean2);
}
项目:12306-android-Decompile    文件:JacksonAnnotationIntrospector.java   
public List<NamedType> findSubtypes(Annotated paramAnnotated)
{
  JsonSubTypes localJsonSubTypes = (JsonSubTypes)paramAnnotated.getAnnotation(JsonSubTypes.class);
  ArrayList localArrayList;
  if (localJsonSubTypes == null)
    localArrayList = null;
  while (true)
  {
    return localArrayList;
    JsonSubTypes.Type[] arrayOfType = localJsonSubTypes.value();
    localArrayList = new ArrayList(arrayOfType.length);
    int i = arrayOfType.length;
    for (int j = 0; j < i; j++)
    {
      JsonSubTypes.Type localType = arrayOfType[j];
      localArrayList.add(new NamedType(localType.value(), localType.name()));
    }
  }
}
项目:ingress-indonesia-dev    文件:StdSubtypeResolver.java   
public Collection<NamedType> collectAndResolveSubtypes(AnnotatedClass paramAnnotatedClass, MapperConfig<?> paramMapperConfig, AnnotationIntrospector paramAnnotationIntrospector)
{
  HashMap localHashMap = new HashMap();
  if (this._registeredSubtypes != null)
  {
    Class localClass = paramAnnotatedClass.getRawType();
    Iterator localIterator = this._registeredSubtypes.iterator();
    while (localIterator.hasNext())
    {
      NamedType localNamedType = (NamedType)localIterator.next();
      if (localClass.isAssignableFrom(localNamedType.getType()))
        _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(localNamedType.getType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
    }
  }
  _collectAndResolve(paramAnnotatedClass, new NamedType(paramAnnotatedClass.getRawType(), null), paramMapperConfig, paramAnnotationIntrospector, localHashMap);
  return new ArrayList(localHashMap.values());
}
项目:ingress-indonesia-dev    文件:StdTypeResolverBuilder.java   
public TypeDeserializer buildTypeDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, BeanProperty paramBeanProperty)
{
  TypeIdResolver localTypeIdResolver = idResolver(paramDeserializationConfig, paramJavaType, paramCollection, false, true);
  switch (StdTypeResolverBuilder.1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$As[this._includeAs.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: " + this._includeAs);
  case 1:
    return new AsArrayTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty, this._defaultImpl);
  case 2:
    return new AsPropertyTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty, this._defaultImpl, this._typeProperty);
  case 3:
    return new AsWrapperTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty, this._defaultImpl);
  case 4:
  }
  return new AsExternalTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty, this._defaultImpl, this._typeProperty);
}
项目:ingress-indonesia-dev    文件:StdTypeResolverBuilder.java   
public TypeSerializer buildTypeSerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, BeanProperty paramBeanProperty)
{
  TypeIdResolver localTypeIdResolver = idResolver(paramSerializationConfig, paramJavaType, paramCollection, true, false);
  switch (StdTypeResolverBuilder.1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$As[this._includeAs.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: " + this._includeAs);
  case 1:
    return new AsArrayTypeSerializer(localTypeIdResolver, paramBeanProperty);
  case 2:
    return new AsPropertyTypeSerializer(localTypeIdResolver, paramBeanProperty, this._typeProperty);
  case 3:
    return new AsWrapperTypeSerializer(localTypeIdResolver, paramBeanProperty);
  case 4:
  }
  return new AsExternalTypeSerializer(localTypeIdResolver, paramBeanProperty, this._typeProperty);
}
项目:ingress-indonesia-dev    文件:StdTypeResolverBuilder.java   
protected TypeIdResolver idResolver(MapperConfig<?> paramMapperConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, boolean paramBoolean1, boolean paramBoolean2)
{
  if (this._customIdResolver != null)
    return this._customIdResolver;
  if (this._idType == null)
    throw new IllegalStateException("Can not build, 'init()' not yet called");
  switch (StdTypeResolverBuilder.1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$Id[this._idType.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type id resolver for idType: " + this._idType);
  case 1:
    return new ClassNameIdResolver(paramJavaType, paramMapperConfig.getTypeFactory());
  case 2:
    return new MinimalClassNameIdResolver(paramJavaType, paramMapperConfig.getTypeFactory());
  case 3:
  }
  return TypeNameIdResolver.construct(paramMapperConfig, paramJavaType, paramCollection, paramBoolean1, paramBoolean2);
}
项目:ingress-indonesia-dev    文件:JacksonAnnotationIntrospector.java   
public List<NamedType> findSubtypes(Annotated paramAnnotated)
{
  JsonSubTypes localJsonSubTypes = (JsonSubTypes)paramAnnotated.getAnnotation(JsonSubTypes.class);
  Object localObject;
  if (localJsonSubTypes == null)
    localObject = null;
  while (true)
  {
    return localObject;
    JsonSubTypes.Type[] arrayOfType = localJsonSubTypes.value();
    localObject = new ArrayList(arrayOfType.length);
    int i = arrayOfType.length;
    for (int j = 0; j < i; j++)
    {
      JsonSubTypes.Type localType = arrayOfType[j];
      ((ArrayList)localObject).add(new NamedType(localType.value(), localType.name()));
    }
  }
}
项目:12306-android-Decompile    文件:TypeNameIdResolver.java   
public static TypeNameIdResolver construct(MapperConfig<?> paramMapperConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, boolean paramBoolean1, boolean paramBoolean2)
{
  if (paramBoolean1 == paramBoolean2)
    throw new IllegalArgumentException();
  HashMap localHashMap1 = null;
  if (paramBoolean1)
    localHashMap1 = new HashMap();
  HashMap localHashMap2 = null;
  if (paramBoolean2)
    localHashMap2 = new HashMap();
  if (paramCollection != null)
  {
    Iterator localIterator = paramCollection.iterator();
    if (localIterator.hasNext())
    {
      NamedType localNamedType = (NamedType)localIterator.next();
      Class localClass = localNamedType.getType();
      if (localNamedType.hasName());
      for (String str = localNamedType.getName(); ; str = _defaultTypeId(localClass))
      {
        if (paramBoolean1)
          localHashMap1.put(localClass.getName(), str);
        if (!paramBoolean2)
          break;
        JavaType localJavaType = (JavaType)localHashMap2.get(str);
        if ((localJavaType != null) && (localClass.isAssignableFrom(localJavaType.getRawClass())))
          break;
        localHashMap2.put(str, paramMapperConfig.constructType(localClass));
        break;
      }
    }
  }
  return new TypeNameIdResolver(paramMapperConfig, paramJavaType, localHashMap1, localHashMap2);
}
项目:12306-android-Decompile    文件:StdSubtypeResolver.java   
public Collection<NamedType> collectAndResolveSubtypes(AnnotatedMember paramAnnotatedMember, MapperConfig<?> paramMapperConfig, AnnotationIntrospector paramAnnotationIntrospector)
{
  HashMap localHashMap = new HashMap();
  if (this._registeredSubtypes != null)
  {
    Class localClass = paramAnnotatedMember.getRawType();
    Iterator localIterator2 = this._registeredSubtypes.iterator();
    while (localIterator2.hasNext())
    {
      NamedType localNamedType3 = (NamedType)localIterator2.next();
      if (!localClass.isAssignableFrom(localNamedType3.getType()))
        continue;
      _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(localNamedType3.getType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType3, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
    }
  }
  List localList = paramAnnotationIntrospector.findSubtypes(paramAnnotatedMember);
  if (localList != null)
  {
    Iterator localIterator1 = localList.iterator();
    while (localIterator1.hasNext())
    {
      NamedType localNamedType2 = (NamedType)localIterator1.next();
      _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(localNamedType2.getType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType2, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
    }
  }
  NamedType localNamedType1 = new NamedType(paramAnnotatedMember.getRawType(), null);
  _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(paramAnnotatedMember.getRawType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType1, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
  return new ArrayList(localHashMap.values());
}
项目:12306-android-Decompile    文件:StdSubtypeResolver.java   
public void registerSubtypes(Class<?>[] paramArrayOfClass)
{
  NamedType[] arrayOfNamedType = new NamedType[paramArrayOfClass.length];
  int i = 0;
  int j = paramArrayOfClass.length;
  while (i < j)
  {
    arrayOfNamedType[i] = new NamedType(paramArrayOfClass[i]);
    i++;
  }
  registerSubtypes(arrayOfNamedType);
}
项目:12306-android-Decompile    文件:StdSubtypeResolver.java   
public void registerSubtypes(NamedType[] paramArrayOfNamedType)
{
  if (this._registeredSubtypes == null)
    this._registeredSubtypes = new LinkedHashSet();
  int i = paramArrayOfNamedType.length;
  for (int j = 0; j < i; j++)
  {
    NamedType localNamedType = paramArrayOfNamedType[j];
    this._registeredSubtypes.add(localNamedType);
  }
}
项目:12306-android-Decompile    文件:StdTypeResolverBuilder.java   
public TypeDeserializer buildTypeDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, BeanProperty paramBeanProperty)
{
  TypeIdResolver localTypeIdResolver = idResolver(paramDeserializationConfig, paramJavaType, paramCollection, false, true);
  switch (1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$As[this._includeAs.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: " + this._includeAs);
  case 1:
    return new AsArrayTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty);
  case 2:
    return new AsPropertyTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty, this._typeProperty);
  case 3:
  }
  return new AsWrapperTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty);
}
项目:12306-android-Decompile    文件:StdTypeResolverBuilder.java   
public TypeSerializer buildTypeSerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, BeanProperty paramBeanProperty)
{
  TypeIdResolver localTypeIdResolver = idResolver(paramSerializationConfig, paramJavaType, paramCollection, true, false);
  switch (1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$As[this._includeAs.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: " + this._includeAs);
  case 1:
    return new AsArrayTypeSerializer(localTypeIdResolver, paramBeanProperty);
  case 2:
    return new AsPropertyTypeSerializer(localTypeIdResolver, paramBeanProperty, this._typeProperty);
  case 3:
  }
  return new AsWrapperTypeSerializer(localTypeIdResolver, paramBeanProperty);
}
项目:12306-android-Decompile    文件:AnnotationIntrospector.java   
public List<NamedType> findSubtypes(Annotated paramAnnotated)
{
  List localList1 = this._primary.findSubtypes(paramAnnotated);
  List localList2 = this._secondary.findSubtypes(paramAnnotated);
  if ((localList1 == null) || (localList1.isEmpty()))
    return localList2;
  if ((localList2 == null) || (localList2.isEmpty()))
    return localList1;
  ArrayList localArrayList = new ArrayList(localList1.size() + localList2.size());
  localArrayList.addAll(localList1);
  localArrayList.addAll(localList2);
  return localArrayList;
}
项目:RHome    文件:TypeNameIdResolver.java   
public static TypeNameIdResolver construct(JavaType baseType,
        Collection<NamedType> subtypes, boolean forSer, boolean forDeser)
{
    // sanity check
    if (forSer == forDeser) throw new IllegalArgumentException();

    HashMap<String, String> typeToId = null;
    HashMap<String, JavaType> idToType = null;

    if (forSer) {
        typeToId = new HashMap<String, String>();
    }
    if (forDeser) {
        idToType = new HashMap<String, JavaType>();
    }
    if (subtypes != null) {
        for (NamedType t : subtypes) {
            /* no name? Need to figure out default; for now, let's just
             * use non-qualified class name
             */
            Class<?> cls = t.getType();
            String id = t.hasName() ? t.getName() : _defaultTypeId(cls);
            if (forSer) {
                typeToId.put(cls.getName(), id);
           }
            if (forDeser) {
                // In case of name collisions, let's make sure first one wins:
                if (!idToType.containsKey(id)) {
                    idToType.put(id, TypeFactory.type(cls));
                }
            }
        }
    }
    return new TypeNameIdResolver(baseType, typeToId, idToType);
}
项目:RHome    文件:StdTypeResolverBuilder.java   
public TypeSerializer buildTypeSerializer(JavaType baseType,
        Collection<NamedType> subtypes)
{
    TypeIdResolver idRes = idResolver(baseType, subtypes, true, false);
    switch (_includeAs) {
    case WRAPPER_ARRAY:
        return new AsArrayTypeSerializer(idRes);
    case PROPERTY:
        return new AsPropertyTypeSerializer(idRes, _typeProperty);
    case WRAPPER_OBJECT:
        return new AsWrapperTypeSerializer(idRes);
    default:
        throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: "+_includeAs);
    }
}
项目:RHome    文件:BeanSerializerFactory.java   
/**
 * 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.
 * 
 * @since 1.5
 */
public TypeSerializer findPropertyTypeSerializer(JavaType baseType, SerializationConfig config,
        AnnotatedMember propertyEntity)
{
    AnnotationIntrospector ai = config.getAnnotationIntrospector();
    TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(propertyEntity, baseType);        
    // Defaulting: if no annotations on member, check value class
    if (b == null) {
        return createTypeSerializer(baseType, config);
    }
    Collection<NamedType> subtypes = SubTypeHelper.collectAndResolveSubtypes(propertyEntity, config, ai);
    return b.buildTypeSerializer(baseType, subtypes);
}
项目:RHome    文件:BeanSerializerFactory.java   
/**
 * 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.
 * 
 * @since 1.5
 */    
public TypeSerializer findPropertyContentTypeSerializer(JavaType containerType, SerializationConfig config,
        AnnotatedMember propertyEntity)
{
    JavaType contentType = containerType.getContentType();
    AnnotationIntrospector ai = config.getAnnotationIntrospector();
    TypeResolverBuilder<?> b = ai.findPropertyContentTypeResolver(propertyEntity, containerType);        
    // Defaulting: if no annotations on member, check value class
    if (b == null) {
        return createTypeSerializer(contentType, config);
    }
    Collection<NamedType> subtypes = SubTypeHelper.collectAndResolveSubtypes(propertyEntity, config, ai);
    return b.buildTypeSerializer(contentType, subtypes);
}
项目:RHome    文件:JacksonAnnotationIntrospector.java   
@Override
public List<NamedType> findSubtypes(Annotated a)
{
    JsonSubTypes t = a.getAnnotation(JsonSubTypes.class);
    if (t == null) return null;
    JsonSubTypes.Type[] types = t.value();
    ArrayList<NamedType> result = new ArrayList<NamedType>(types.length);
    for (JsonSubTypes.Type type : types) {
        result.add(new NamedType(type.value(), type.name()));
    }
    return result;
}
项目:RHome    文件:BasicDeserializerFactory.java   
/**
 * Method called to find and create a type information deserializer for values of
 * given container (list, array, map) property, if one is needed.
 * If not needed (no polymorphic handling configured for property), should return null.
 *<p>
 * Note that this method is only called for container bean properties,
 * and not for values in container types or root values (or non-container properties)
 * 
 * @param containerType Type of property; must be a container type
 * @param propertyEntity Field or method that contains container property
 * 
 * @since 1.5
 */    
public TypeDeserializer findPropertyContentTypeDeserializer(DeserializationConfig config, JavaType containerType,
        AnnotatedMember propertyEntity)
{
    AnnotationIntrospector ai = config.getAnnotationIntrospector();
    TypeResolverBuilder<?> b = ai.findPropertyContentTypeResolver(propertyEntity, containerType);        
    JavaType contentType = containerType.getContentType();
    // Defaulting: if no annotations on member, check class
    if (b == null) {
        return findTypeDeserializer(config, contentType);
    }
    // but if annotations found, may need to resolve subtypes:
    Collection<NamedType> subtypes = SubTypeHelper.collectAndResolveSubtypes(propertyEntity, config, ai);
    return b.buildTypeDeserializer(contentType, subtypes);
}
项目:RHome    文件:AnnotationIntrospector.java   
@Override
public List<NamedType> findSubtypes(Annotated a)
{
    List<NamedType> types1 = _primary.findSubtypes(a);
    List<NamedType> types2 = _secondary.findSubtypes(a);
    if (types1 == null || types1.isEmpty()) return types2;
    if (types2 == null || types2.isEmpty()) return types1;
    ArrayList<NamedType> result = new ArrayList<NamedType>(types1.size() + types2.size());
    result.addAll(types1);
    result.addAll(types2);
    return result;
}
项目:RHome    文件:SubTypeHelper.java   
/**
 * 
 * @param rootType If type resolution started with a root type, definition of
 *   that type; null if 
 * @return
 */
protected List<NamedType> _collectAndResolve(AnnotatedClass rootType,
            MapperConfig<?> config, AnnotationIntrospector ai, Collection<NamedType> subtypeList)
{
    // Hmmh. Can't iterate over collection and modify it, so:
    HashSet<NamedType> seen = new HashSet<NamedType>(subtypeList);          
    ArrayList<NamedType> subtypes = new ArrayList<NamedType>(subtypeList);

    // Plus root type can have name of its own...
    NamedType rootNamedType = (rootType == null) ? null
            : new NamedType(rootType.getRawType(), ai.findTypeName(rootType));                
    if (rootNamedType != null) {
        seen.add(rootNamedType);
    }

    // collect all subtypes iteratively
    for (int i = 0; i < subtypes.size(); ++i) {
            NamedType type = subtypes.get(i);
        AnnotatedClass ac = AnnotatedClass.constructWithoutSuperTypes(type.getType(), ai, config);
        // but first: does type have a name already?
        if (!type.hasName()) { // if not, let's see if annotations define it
            type.setName(ai.findTypeName(ac));
        }
        // and see if annotations list more subtypes
        List<NamedType> moreTypes = ai.findSubtypes(ac);
        if (moreTypes != null) {
            for (NamedType t2 : moreTypes) {
                // we want to keep the first reference (may have name)
                if (seen.add(t2)) {
                    subtypes.add(t2);
                }
            }
        }
    }
    // and finally, root type with its name too:
    if (rootNamedType != null) {
        subtypes.add(rootNamedType);
    }
    return subtypes;
}
项目:12306-android-Decompile    文件:TypeNameIdResolver.java   
public static TypeNameIdResolver construct(MapperConfig<?> paramMapperConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, boolean paramBoolean1, boolean paramBoolean2)
{
  if (paramBoolean1 == paramBoolean2)
    throw new IllegalArgumentException();
  HashMap localHashMap1 = null;
  if (paramBoolean1)
    localHashMap1 = new HashMap();
  HashMap localHashMap2 = null;
  if (paramBoolean2)
    localHashMap2 = new HashMap();
  if (paramCollection != null)
  {
    Iterator localIterator = paramCollection.iterator();
    if (localIterator.hasNext())
    {
      NamedType localNamedType = (NamedType)localIterator.next();
      Class localClass = localNamedType.getType();
      if (localNamedType.hasName());
      for (String str = localNamedType.getName(); ; str = _defaultTypeId(localClass))
      {
        if (paramBoolean1)
          localHashMap1.put(localClass.getName(), str);
        if (!paramBoolean2)
          break;
        JavaType localJavaType = (JavaType)localHashMap2.get(str);
        if ((localJavaType != null) && (localClass.isAssignableFrom(localJavaType.getRawClass())))
          break;
        localHashMap2.put(str, paramMapperConfig.constructType(localClass));
        break;
      }
    }
  }
  return new TypeNameIdResolver(paramMapperConfig, paramJavaType, localHashMap1, localHashMap2);
}
项目:12306-android-Decompile    文件:StdSubtypeResolver.java   
public Collection<NamedType> collectAndResolveSubtypes(AnnotatedMember paramAnnotatedMember, MapperConfig<?> paramMapperConfig, AnnotationIntrospector paramAnnotationIntrospector)
{
  HashMap localHashMap = new HashMap();
  if (this._registeredSubtypes != null)
  {
    Class localClass = paramAnnotatedMember.getRawType();
    Iterator localIterator2 = this._registeredSubtypes.iterator();
    while (localIterator2.hasNext())
    {
      NamedType localNamedType3 = (NamedType)localIterator2.next();
      if (!localClass.isAssignableFrom(localNamedType3.getType()))
        continue;
      _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(localNamedType3.getType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType3, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
    }
  }
  List localList = paramAnnotationIntrospector.findSubtypes(paramAnnotatedMember);
  if (localList != null)
  {
    Iterator localIterator1 = localList.iterator();
    while (localIterator1.hasNext())
    {
      NamedType localNamedType2 = (NamedType)localIterator1.next();
      _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(localNamedType2.getType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType2, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
    }
  }
  NamedType localNamedType1 = new NamedType(paramAnnotatedMember.getRawType(), null);
  _collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(paramAnnotatedMember.getRawType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType1, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
  return new ArrayList(localHashMap.values());
}
项目:12306-android-Decompile    文件:StdSubtypeResolver.java   
public void registerSubtypes(Class<?>[] paramArrayOfClass)
{
  NamedType[] arrayOfNamedType = new NamedType[paramArrayOfClass.length];
  int i = 0;
  int j = paramArrayOfClass.length;
  while (i < j)
  {
    arrayOfNamedType[i] = new NamedType(paramArrayOfClass[i]);
    i++;
  }
  registerSubtypes(arrayOfNamedType);
}
项目:12306-android-Decompile    文件:StdSubtypeResolver.java   
public void registerSubtypes(NamedType[] paramArrayOfNamedType)
{
  if (this._registeredSubtypes == null)
    this._registeredSubtypes = new LinkedHashSet();
  int i = paramArrayOfNamedType.length;
  for (int j = 0; j < i; j++)
  {
    NamedType localNamedType = paramArrayOfNamedType[j];
    this._registeredSubtypes.add(localNamedType);
  }
}
项目:12306-android-Decompile    文件:StdTypeResolverBuilder.java   
public TypeDeserializer buildTypeDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, BeanProperty paramBeanProperty)
{
  TypeIdResolver localTypeIdResolver = idResolver(paramDeserializationConfig, paramJavaType, paramCollection, false, true);
  switch (1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$As[this._includeAs.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: " + this._includeAs);
  case 1:
    return new AsArrayTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty);
  case 2:
    return new AsPropertyTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty, this._typeProperty);
  case 3:
  }
  return new AsWrapperTypeDeserializer(paramJavaType, localTypeIdResolver, paramBeanProperty);
}
项目:12306-android-Decompile    文件:StdTypeResolverBuilder.java   
public TypeSerializer buildTypeSerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, BeanProperty paramBeanProperty)
{
  TypeIdResolver localTypeIdResolver = idResolver(paramSerializationConfig, paramJavaType, paramCollection, true, false);
  switch (1.$SwitchMap$org$codehaus$jackson$annotate$JsonTypeInfo$As[this._includeAs.ordinal()])
  {
  default:
    throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: " + this._includeAs);
  case 1:
    return new AsArrayTypeSerializer(localTypeIdResolver, paramBeanProperty);
  case 2:
    return new AsPropertyTypeSerializer(localTypeIdResolver, paramBeanProperty, this._typeProperty);
  case 3:
  }
  return new AsWrapperTypeSerializer(localTypeIdResolver, paramBeanProperty);
}
项目:12306-android-Decompile    文件:AnnotationIntrospector.java   
public List<NamedType> findSubtypes(Annotated paramAnnotated)
{
  List localList1 = this._primary.findSubtypes(paramAnnotated);
  List localList2 = this._secondary.findSubtypes(paramAnnotated);
  if ((localList1 == null) || (localList1.isEmpty()))
    return localList2;
  if ((localList2 == null) || (localList2.isEmpty()))
    return localList1;
  ArrayList localArrayList = new ArrayList(localList1.size() + localList2.size());
  localArrayList.addAll(localList1);
  localArrayList.addAll(localList2);
  return localArrayList;
}
项目:ingress-indonesia-dev    文件:TypeNameIdResolver.java   
public static TypeNameIdResolver construct(MapperConfig<?> paramMapperConfig, JavaType paramJavaType, Collection<NamedType> paramCollection, boolean paramBoolean1, boolean paramBoolean2)
{
  if (paramBoolean1 == paramBoolean2)
    throw new IllegalArgumentException();
  if (paramBoolean1);
  for (HashMap localHashMap1 = new HashMap(); ; localHashMap1 = null)
  {
    if (paramBoolean2);
    for (HashMap localHashMap2 = new HashMap(); ; localHashMap2 = null)
    {
      if (paramCollection != null)
      {
        Iterator localIterator = paramCollection.iterator();
        if (localIterator.hasNext())
        {
          NamedType localNamedType = (NamedType)localIterator.next();
          Class localClass = localNamedType.getType();
          if (localNamedType.hasName());
          for (String str = localNamedType.getName(); ; str = _defaultTypeId(localClass))
          {
            if (paramBoolean1)
              localHashMap1.put(localClass.getName(), str);
            if (!paramBoolean2)
              break;
            JavaType localJavaType = (JavaType)localHashMap2.get(str);
            if ((localJavaType != null) && (localClass.isAssignableFrom(localJavaType.getRawClass())))
              break;
            localHashMap2.put(str, paramMapperConfig.constructType(localClass));
            break;
          }
        }
      }
      return new TypeNameIdResolver(paramMapperConfig, paramJavaType, localHashMap1, localHashMap2);
    }
  }
}
项目:ingress-indonesia-dev    文件:StdSubtypeResolver.java   
protected void _collectAndResolve(AnnotatedClass paramAnnotatedClass, NamedType paramNamedType, MapperConfig<?> paramMapperConfig, AnnotationIntrospector paramAnnotationIntrospector, HashMap<NamedType, NamedType> paramHashMap)
{
  if (!paramNamedType.hasName())
  {
    String str = paramAnnotationIntrospector.findTypeName(paramAnnotatedClass);
    if (str != null)
      paramNamedType = new NamedType(paramNamedType.getType(), str);
  }
  if (paramHashMap.containsKey(paramNamedType))
    if ((paramNamedType.hasName()) && (!((NamedType)paramHashMap.get(paramNamedType)).hasName()))
      paramHashMap.put(paramNamedType, paramNamedType);
  List localList;
  do
  {
    return;
    paramHashMap.put(paramNamedType, paramNamedType);
    localList = paramAnnotationIntrospector.findSubtypes(paramAnnotatedClass);
  }
  while ((localList == null) || (localList.isEmpty()));
  Iterator localIterator = localList.iterator();
  label114: NamedType localNamedType1;
  AnnotatedClass localAnnotatedClass;
  if (localIterator.hasNext())
  {
    localNamedType1 = (NamedType)localIterator.next();
    localAnnotatedClass = AnnotatedClass.constructWithoutSuperTypes(localNamedType1.getType(), paramAnnotationIntrospector, paramMapperConfig);
    if (localNamedType1.hasName())
      break label194;
  }
  label194: for (NamedType localNamedType2 = new NamedType(localNamedType1.getType(), paramAnnotationIntrospector.findTypeName(localAnnotatedClass)); ; localNamedType2 = localNamedType1)
  {
    _collectAndResolve(localAnnotatedClass, localNamedType2, paramMapperConfig, paramAnnotationIntrospector, paramHashMap);
    break label114;
    break;
  }
}