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()); }
public void fromAnnotations(Class<?> paramClass) { AnnotationIntrospector localAnnotationIntrospector = getAnnotationIntrospector(); AnnotatedClass localAnnotatedClass = AnnotatedClass.construct(paramClass, localAnnotationIntrospector, null); this._base = this._base.withVisibilityChecker(localAnnotationIntrospector.findAutoDetectVisibility(localAnnotatedClass, getDefaultVisibilityChecker())); JsonSerialize.Inclusion localInclusion = localAnnotationIntrospector.findSerializationInclusion(localAnnotatedClass, null); if (localInclusion != this._serializationInclusion) setSerializationInclusion(localInclusion); JsonSerialize.Typing localTyping = localAnnotationIntrospector.findSerializationTyping(localAnnotatedClass); Feature localFeature; if (localTyping != null) { localFeature = Feature.USE_STATIC_TYPING; if (localTyping != JsonSerialize.Typing.STATIC) break label92; } label92: for (boolean bool = true; ; bool = false) { set(localFeature, bool); return; } }
public TypeDeserializer findTypeDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType, BeanProperty paramBeanProperty) { AnnotatedClass localAnnotatedClass = ((BasicBeanDescription)paramDeserializationConfig.introspectClassAnnotations(paramJavaType.getRawClass())).getClassInfo(); AnnotationIntrospector localAnnotationIntrospector = paramDeserializationConfig.getAnnotationIntrospector(); TypeResolverBuilder localTypeResolverBuilder = localAnnotationIntrospector.findTypeResolver(paramDeserializationConfig, localAnnotatedClass, paramJavaType); Collection localCollection; if (localTypeResolverBuilder == null) { localTypeResolverBuilder = paramDeserializationConfig.getDefaultTyper(paramJavaType); localCollection = null; if (localTypeResolverBuilder == null) return null; } else { localCollection = paramDeserializationConfig.getSubtypeResolver().collectAndResolveSubtypes(localAnnotatedClass, paramDeserializationConfig, localAnnotationIntrospector); } return localTypeResolverBuilder.buildTypeDeserializer(paramDeserializationConfig, paramJavaType, localCollection, paramBeanProperty); }
public BeanDeserializer(AnnotatedClass paramAnnotatedClass, JavaType paramJavaType, BeanProperty paramBeanProperty, CreatorContainer paramCreatorContainer, BeanPropertyMap paramBeanPropertyMap, Map<String, SettableBeanProperty> paramMap, HashSet<String> paramHashSet, boolean paramBoolean, SettableAnyProperty paramSettableAnyProperty) { super(paramJavaType); this._forClass = paramAnnotatedClass; this._beanType = paramJavaType; this._property = paramBeanProperty; this._beanProperties = paramBeanPropertyMap; this._backRefs = paramMap; this._ignorableProps = paramHashSet; this._ignoreAllUnknown = paramBoolean; this._anySetter = paramSettableAnyProperty; this._stringCreator = paramCreatorContainer.stringCreator(); this._numberCreator = paramCreatorContainer.numberCreator(); this._delegatingCreator = paramCreatorContainer.delegatingCreator(); this._propertyBasedCreator = paramCreatorContainer.propertyBasedCreator(); if ((this._delegatingCreator != null) || (this._propertyBasedCreator != null)) { this._defaultConstructor = null; return; } this._defaultConstructor = paramCreatorContainer.getDefaultConstructor(); }
public String findRootName(AnnotatedClass paramAnnotatedClass) { String str1 = this._primary.findRootName(paramAnnotatedClass); if (str1 == null) str1 = this._secondary.findRootName(paramAnnotatedClass); String str2; do { do return str1; while (str1.length() > 0); str2 = this._secondary.findRootName(paramAnnotatedClass); } while (str2 == null); return str2; }
/** * Overridable method that can filter out properties. Default implementation * checks annotations class may have. */ protected List<BeanPropertyWriter> filterBeanProperties(SerializationConfig config, BasicBeanDescription beanDesc, List<BeanPropertyWriter> props) { AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); String[] ignored = intr.findPropertiesToIgnore(ac); if (ignored != null && ignored.length > 0) { HashSet<String> ignoredSet = ArrayBuilders.arrayToSet(ignored); Iterator<BeanPropertyWriter> it = props.iterator(); while (it.hasNext()) { if (ignoredSet.contains(it.next().getName())) { it.remove(); } } } return props; }
/** * Overridable method that will impose given partial ordering on * list of discovered propertied. Method can be overridden to * provide custom ordering of properties, beyond configurability * offered by annotations (whic allow alphabetic ordering, as * well as explicit ordering by providing array of property names). *<p> * By default Creator properties will be ordered before other * properties. Explicit custom ordering will override this implicit * default ordering. */ protected List<BeanPropertyWriter> sortBeanProperties(SerializationConfig config, BasicBeanDescription beanDesc, List<BeanPropertyWriter> props) { // Ok: so far so good. But do we need to (re)order these somehow? /* Yes; first, for [JACKSON-90] (explicit ordering and/or alphabetic) * and then for [JACKSON-170] (implicitly order creator properties before others) */ List<String> creatorProps = beanDesc.findCreatorPropertyNames(); // Then how about explicit ordering? AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); String[] propOrder = intr.findSerializationPropertyOrder(ac); Boolean alpha = intr.findSerializationSortAlphabetically(ac); boolean sort = (alpha != null) && alpha.booleanValue(); if (sort || !creatorProps.isEmpty() || propOrder != null) { props = _sortBeanProperties(props, creatorProps, propOrder, sort); } return props; }
/** * 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); }
/** * Method that checks class annotations that the argument Object has, * and modifies settings of this configuration object accordingly, * similar to how those annotations would affect actual value classes * annotated with them, but with global scope. Note that not all * annotations have global significance, and thus only subset of * Jackson annotations will have any effect. *<p> * Serialization annotations that are known to have effect are: *<ul> * <li>{@link JsonWriteNullProperties}</li> * <li>{@link JsonAutoDetect}</li> * <li>{@link JsonSerialize#typing}</li> *</ul> * * @param cls Class of which class annotations to use * for changing configuration settings */ //@Override public void fromAnnotations(Class<?> cls) { /* 10-Jul-2009, tatu: Should be able to just pass null as * 'MixInResolver'; no mix-ins set at this point * 29-Jul-2009, tatu: Also, we do NOT ignore annotations here, even * if Feature.USE_ANNOTATIONS was disabled, since caller * specifically requested annotations to be added with this call */ AnnotatedClass ac = AnnotatedClass.construct(cls, _annotationIntrospector, null); _visibilityChecker = _annotationIntrospector.findAutoDetectVisibility(ac, _visibilityChecker); // How about writing null property values? JsonSerialize.Inclusion incl = _annotationIntrospector.findSerializationInclusion(ac, null); if (incl != _serializationInclusion) { setSerializationInclusion(incl); } JsonSerialize.Typing typing = _annotationIntrospector.findSerializationTyping(ac); if (typing != null) { set(Feature.USE_STATIC_TYPING, (typing == JsonSerialize.Typing.STATIC)); } }
@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); }
/** * Method that checks class annotations that the argument Object has, * and modifies settings of this configuration object accordingly, * similar to how those annotations would affect actual value classes * annotated with them, but with global scope. Note that not all * annotations have global significance, and thus only subset of * Jackson annotations will have any effect. *<p> * Ones that are known to have effect are: *<ul> * <li>{@link JsonAutoDetect}</li> *</ul> * * @param cls Class of which class annotations to use * for changing configuration settings */ //@Override public void fromAnnotations(Class<?> cls) { /* no class annotation for: * * - CAN_OVERRIDE_ACCESS_MODIFIERS * - USE_BIG_DECIMAL_FOR_FLOATS * - USE_BIG_INTEGER_FOR_INTS * - USE_GETTERS_AS_SETTERS */ /* 10-Jul-2009, tatu: Should be able to just pass null as * 'MixInResolver'; no mix-ins set at this point */ AnnotatedClass ac = AnnotatedClass.construct(cls, _annotationIntrospector, null); // visibility checks handled via separate checker object... _visibilityChecker = _annotationIntrospector.findAutoDetectVisibility(ac, _visibilityChecker); }
/** * * @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); }
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()); }
@Override public VisibilityChecker<?> findAutoDetectVisibility(AnnotatedClass ac, VisibilityChecker<?> checker) { return checker.withFieldVisibility(Visibility.NONE) .withSetterVisibility(Visibility.PUBLIC_ONLY) .withGetterVisibility(Visibility.PUBLIC_ONLY) .withIsGetterVisibility(Visibility.PUBLIC_ONLY) ; }
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()); }
protected List<BeanPropertyWriter> sortBeanProperties(SerializationConfig paramSerializationConfig, BasicBeanDescription paramBasicBeanDescription, List<BeanPropertyWriter> paramList) { List localList = paramBasicBeanDescription.findCreatorPropertyNames(); AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector(); AnnotatedClass localAnnotatedClass = paramBasicBeanDescription.getClassInfo(); String[] arrayOfString = localAnnotationIntrospector.findSerializationPropertyOrder(localAnnotatedClass); Boolean localBoolean = localAnnotationIntrospector.findSerializationSortAlphabetically(localAnnotatedClass); if (localBoolean == null); for (boolean bool = paramSerializationConfig.isEnabled(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY); ; bool = localBoolean.booleanValue()) { if ((bool) || (!localList.isEmpty()) || (arrayOfString != null)) paramList = _sortBeanProperties(paramList, localList, arrayOfString, bool); return paramList; } }
public TypeSerializer createTypeSerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType, BeanProperty paramBeanProperty) { AnnotatedClass localAnnotatedClass = ((BasicBeanDescription)paramSerializationConfig.introspectClassAnnotations(paramJavaType.getRawClass())).getClassInfo(); AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector(); TypeResolverBuilder localTypeResolverBuilder = localAnnotationIntrospector.findTypeResolver(paramSerializationConfig, localAnnotatedClass, paramJavaType); Collection localCollection = null; if (localTypeResolverBuilder == null) localTypeResolverBuilder = paramSerializationConfig.getDefaultTyper(paramJavaType); while (localTypeResolverBuilder == null) { return null; localCollection = paramSerializationConfig.getSubtypeResolver().collectAndResolveSubtypes(localAnnotatedClass, paramSerializationConfig, localAnnotationIntrospector); } return localTypeResolverBuilder.buildTypeSerializer(paramSerializationConfig, paramJavaType, localCollection, paramBeanProperty); }
public void fromAnnotations(Class<?> paramClass) { AnnotationIntrospector localAnnotationIntrospector = getAnnotationIntrospector(); AnnotatedClass localAnnotatedClass = AnnotatedClass.construct(paramClass, localAnnotationIntrospector, null); VisibilityChecker localVisibilityChecker = getDefaultVisibilityChecker(); this._base = this._base.withVisibilityChecker(localAnnotationIntrospector.findAutoDetectVisibility(localAnnotatedClass, localVisibilityChecker)); }
public Boolean findCachability(AnnotatedClass paramAnnotatedClass) { Boolean localBoolean = this._primary.findCachability(paramAnnotatedClass); if (localBoolean == null) localBoolean = this._secondary.findCachability(paramAnnotatedClass); return localBoolean; }
public Object findFilterId(AnnotatedClass paramAnnotatedClass) { Object localObject = this._primary.findFilterId(paramAnnotatedClass); if (localObject == null) localObject = this._secondary.findFilterId(paramAnnotatedClass); return localObject; }
public Boolean findIgnoreUnknownProperties(AnnotatedClass paramAnnotatedClass) { Boolean localBoolean = this._primary.findIgnoreUnknownProperties(paramAnnotatedClass); if (localBoolean == null) localBoolean = this._secondary.findIgnoreUnknownProperties(paramAnnotatedClass); return localBoolean; }
public String[] findPropertiesToIgnore(AnnotatedClass paramAnnotatedClass) { String[] arrayOfString = this._primary.findPropertiesToIgnore(paramAnnotatedClass); if (arrayOfString == null) arrayOfString = this._secondary.findPropertiesToIgnore(paramAnnotatedClass); return arrayOfString; }
public String[] findSerializationPropertyOrder(AnnotatedClass paramAnnotatedClass) { String[] arrayOfString = this._primary.findSerializationPropertyOrder(paramAnnotatedClass); if (arrayOfString == null) arrayOfString = this._secondary.findSerializationPropertyOrder(paramAnnotatedClass); return arrayOfString; }
public Boolean findSerializationSortAlphabetically(AnnotatedClass paramAnnotatedClass) { Boolean localBoolean = this._primary.findSerializationSortAlphabetically(paramAnnotatedClass); if (localBoolean == null) localBoolean = this._secondary.findSerializationSortAlphabetically(paramAnnotatedClass); return localBoolean; }
public String findTypeName(AnnotatedClass paramAnnotatedClass) { String str = this._primary.findTypeName(paramAnnotatedClass); if ((str == null) || (str.length() == 0)) str = this._secondary.findTypeName(paramAnnotatedClass); return str; }
public TypeResolverBuilder<?> findTypeResolver(MapperConfig<?> paramMapperConfig, AnnotatedClass paramAnnotatedClass, JavaType paramJavaType) { TypeResolverBuilder localTypeResolverBuilder = this._primary.findTypeResolver(paramMapperConfig, paramAnnotatedClass, paramJavaType); if (localTypeResolverBuilder == null) localTypeResolverBuilder = this._secondary.findTypeResolver(paramMapperConfig, paramAnnotatedClass, paramJavaType); return localTypeResolverBuilder; }
public Boolean isIgnorableType(AnnotatedClass paramAnnotatedClass) { Boolean localBoolean = this._primary.isIgnorableType(paramAnnotatedClass); if (localBoolean == null) localBoolean = this._secondary.isIgnorableType(paramAnnotatedClass); return localBoolean; }
/** * * @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; }