/** * Helper method called to check if a class or method * has annotation that tells which class to use for deserialization. * Returns null if no such annotation found. */ protected JsonDeserializer<Object> findDeserializerFromAnnotation(DeserializationConfig config, Annotated ann, BeanProperty property) throws JsonMappingException { Object deserDef = config.getAnnotationIntrospector().findDeserializer(ann); if (deserDef != null) { return _constructDeserializer(config, ann, property, deserDef); } return null; }
protected EnumResolver<?> constructEnumResolver(Class<?> enumClass, DeserializationConfig config) { // [JACKSON-212]: may need to use Enum.toString() if (config.isEnabled(DeserializationConfig.Feature.READ_ENUMS_USING_TO_STRING)) { return EnumResolver.constructUnsafeUsingToString(enumClass); } return EnumResolver.constructUnsafe(enumClass, config.getAnnotationIntrospector()); } }
/** * Helper method that will check whether given raw type is marked as always ignorable * (for purpose of ignoring properties with type) */ protected boolean isIgnorableType(DeserializationConfig config, BasicBeanDescription beanDesc, Class<?> type, Map<Class<?>,Boolean> ignoredTypes) { Boolean status = ignoredTypes.get(type); if (status == null) { BasicBeanDescription desc = config.introspectClassAnnotations(type); status = config.getAnnotationIntrospector().isIgnorableType(desc.getClassInfo()); // We default to 'false', ie. not ignorable if (status == null) { status = Boolean.FALSE; } } return status; } }
AnnotationIntrospector aintr = config.getAnnotationIntrospector();
Object instDef = config.getAnnotationIntrospector().findValueInstantiator(ac); if (instDef != null) { if (instDef instanceof ValueInstantiator) {
AnnotationIntrospector ai = getAnnotationIntrospector(); AnnotatedClass ac = AnnotatedClass.construct(cls, ai, null);
/** * Helper method called to see if given property might be so-called unwrapped * property: these require special handling. * * @since 1.9 */ protected SettableBeanProperty _resolveUnwrappedProperty(DeserializationConfig config, SettableBeanProperty prop) { AnnotatedMember am = prop.getMember(); if (am != null && config.getAnnotationIntrospector().shouldUnwrapProperty(am) == Boolean.TRUE) { JsonDeserializer<Object> orig = prop.getValueDeserializer(); JsonDeserializer<Object> unwrapping = orig.unwrappingDeserializer(); if (unwrapping != orig && unwrapping != null) { // might be cleaner to create new instance; but difficult to do reliably, so: return prop.withValueDeserializer(unwrapping); } } return null; }
/** * Method called to create a type information deserializer for values of * given non-container 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 non-container bean properties, * and not for values in container types or root values (or container properties) * * @param baseType Declared base type of the value to deserializer (actual * deserializer type will be this type or its subtype) * * @return Type deserializer to use for given base type, if one is needed; null if not. * * @since 1.5 */ public TypeDeserializer findPropertyTypeDeserializer(DeserializationConfig config, JavaType baseType, AnnotatedMember annotated, BeanProperty property) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(config, annotated, baseType); // Defaulting: if no annotations on member, check value class if (b == null) { return findTypeDeserializer(config, baseType, property); } // but if annotations found, may need to resolve subtypes: Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypes(annotated, config, ai); return b.buildTypeDeserializer(config, baseType, subtypes, property); }
if (config.getAnnotationIntrospector().hasCreatorAnnotation(factory)) { int argCount = factory.getParameterCount(); if (argCount == 1) {
/** * 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, BeanProperty property) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyContentTypeResolver(config, propertyEntity, containerType); JavaType contentType = containerType.getContentType(); // Defaulting: if no annotations on member, check class if (b == null) { return findTypeDeserializer(config, contentType, property); } // but if annotations found, may need to resolve subtypes: Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypes(propertyEntity, config, ai); return b.buildTypeDeserializer(config, contentType, subtypes, property); }
if (config.getAnnotationIntrospector().hasCreatorAnnotation(factory)) { int argCount = factory.getParameterCount(); if (argCount == 1) {
AnnotationIntrospector intr = config.getAnnotationIntrospector(); vchecker = config.getAnnotationIntrospector().findAutoDetectVisibility(beanDesc.getClassInfo(), vchecker);
AnnotationIntrospector intr = config.getAnnotationIntrospector(); Class<?> subclass = intr.findDeserializationType(a, type, propName); if (subclass != null) {
md.setIgnorableProperties(config.getAnnotationIntrospector().findPropertiesToIgnore(beanDesc.getClassInfo())); return md;
AnnotationIntrospector intr = config.getAnnotationIntrospector(); boolean ignoreAny = false;
BasicBeanDescription bean = config.introspectClassAnnotations(cls); AnnotatedClass ac = bean.getClassInfo(); AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findTypeResolver(config, ac, baseType);
AnnotationIntrospector intr = config.getAnnotationIntrospector(); JavaType keyType = type.getKeyType(); if (keyType != null) {
AnnotationIntrospector.ReferenceProperty ref = config.getAnnotationIntrospector().findReferenceType(field); if (ref != null && ref.isManagedReference()) { prop.setManagedReferenceName(ref.getName());
AnnotationIntrospector.ReferenceProperty ref = config.getAnnotationIntrospector().findReferenceType(setter); if (ref != null && ref.isManagedReference()) { prop.setManagedReferenceName(ref.getName());
protected EnumResolver<?> constructEnumResolver(Class<?> enumClass, DeserializationConfig config) { // [JACKSON-212]: may need to use Enum.toString() if (config.isEnabled(DeserializationConfig.Feature.READ_ENUMS_USING_TO_STRING)) { return EnumResolver.constructUnsafeUsingToString(enumClass); } return EnumResolver.constructUnsafe(enumClass, config.getAnnotationIntrospector()); } }