Package org.codehaus.jackson.map.deser
Class BeanDeserializerFactory
- java.lang.Object
-
- org.codehaus.jackson.map.DeserializerFactory
-
- org.codehaus.jackson.map.deser.BasicDeserializerFactory
-
- org.codehaus.jackson.map.deser.BeanDeserializerFactory
-
- Direct Known Subclasses:
CustomDeserializerFactory
public class BeanDeserializerFactory extends BasicDeserializerFactory
Concrete deserializer factory class that adds full Bean deserializer construction logic using class introspection.Since there is no caching, this factory is stateless and a globally shared singleton instance (
instance) can be used byDeserializerProviders).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBeanDeserializerFactory.ConfigImplStandard configuration settings container class implementation.-
Nested classes/interfaces inherited from class org.codehaus.jackson.map.DeserializerFactory
DeserializerFactory.Config
-
-
Field Summary
Fields Modifier and Type Field Description protected DeserializerFactory.Config_factoryConfigConfiguration settings for this factory; immutable instance (just like this factory), new version created via copy-constructor (fluent-style)static BeanDeserializerFactoryinstanceGlobally shareable thread-safe instance which has no additional custom deserializers registered-
Fields inherited from class org.codehaus.jackson.map.deser.BasicDeserializerFactory
_arrayDeserializers, optionalHandlers
-
Fields inherited from class org.codehaus.jackson.map.DeserializerFactory
NO_DESERIALIZERS
-
-
Constructor Summary
Constructors Constructor Description BeanDeserializerFactory()Deprecated.BeanDeserializerFactory(DeserializerFactory.Config config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_addDeserializerConstructors(DeserializationConfig config, BasicBeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators)protected void_addDeserializerFactoryMethods(DeserializationConfig config, BasicBeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators)protected JsonDeserializer<?>_findCustomArrayDeserializer(ArrayType type, DeserializationConfig config, DeserializerProvider provider, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)protected JsonDeserializer<java.lang.Object>_findCustomBeanDeserializer(JavaType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property)protected JsonDeserializer<?>_findCustomCollectionDeserializer(CollectionType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)protected JsonDeserializer<?>_findCustomCollectionLikeDeserializer(CollectionLikeType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)protected JsonDeserializer<?>_findCustomEnumDeserializer(java.lang.Class<?> type, DeserializationConfig config, BasicBeanDescription beanDesc, BeanProperty property)protected JsonDeserializer<?>_findCustomMapDeserializer(MapType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)protected JsonDeserializer<?>_findCustomMapLikeDeserializer(MapLikeType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)protected JsonDeserializer<?>_findCustomTreeNodeDeserializer(java.lang.Class<? extends JsonNode> type, DeserializationConfig config, BeanProperty property)protected boolean_handleSingleArgumentConstructor(DeserializationConfig config, BasicBeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, AnnotatedConstructor ctor, boolean isCreator, boolean isVisible)protected boolean_handleSingleArgumentFactory(DeserializationConfig config, BasicBeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, AnnotatedMethod factory, boolean isCreator)protected JavaType_mapAbstractType2(DeserializationConfig config, JavaType type)Method that will find abstract type mapping for specified type, doing a single lookup through registered abstract type resolvers; will not do recursive lookups.protected voidaddBeanProps(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder)Method called to figure out settable properties for the bean deserializer to use.protected voidaddInjectables(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder)Method called locate all members used for value injection (if any), constructorValueInjectorinstances, and add them to builder.protected voidaddReferenceProperties(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder)Method that will find if bean has any managed- or back-reference properties, and if so add them to bean, to be linked during resolution phase.JsonDeserializer<java.lang.Object>buildBeanDeserializer(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc, BeanProperty property)Method that is to actually build a bean deserializer instance.JsonDeserializer<java.lang.Object>buildThrowableDeserializer(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc, BeanProperty property)protected SettableAnyPropertyconstructAnySetter(DeserializationConfig config, BasicBeanDescription beanDesc, AnnotatedMethod setter)Method called to construct fallbackSettableAnyPropertyfor handling unknown bean properties, given a method that has been designated as such setter.protected BeanDeserializerBuilderconstructBeanDeserializerBuilder(BasicBeanDescription beanDesc)Overridable method that constructs aBeanDeserializerBuilderwhich is used to accumulate information needed to create deserializer instance.protected CreatorPropertyconstructCreatorProperty(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.String name, int index, AnnotatedParameter param, java.lang.Object injectableValueId)Method that will construct a property object that represents a logical property passed via Creator (constructor or static factory method)protected ValueInstantiatorconstructDefaultValueInstantiator(DeserializationConfig config, BasicBeanDescription beanDesc)Method that will construct standard defaultValueInstantiatorusing annotations (like @JsonCreator) and visibility rulesprotected SettableBeanPropertyconstructSettableProperty(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.String name, AnnotatedField field)protected SettableBeanPropertyconstructSettableProperty(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.String name, AnnotatedMethod setter)Method that will construct a regular bean property setter using the given setter method.protected SettableBeanPropertyconstructSetterlessProperty(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.String name, AnnotatedMethod getter)Method that will construct a regular bean property setter using the given setter method.JsonDeserializer<java.lang.Object>createBeanDeserializer(DeserializationConfig config, DeserializerProvider p, JavaType type, BeanProperty property)Method thatDeserializerProviders call to create a new deserializer for types other than Collections, Maps, arrays and enums.KeyDeserializercreateKeyDeserializer(DeserializationConfig config, JavaType type, BeanProperty property)Method called to find if factory knows how to create a key deserializer for specified type; currently this means checking if a module has registered possible deserializers.ValueInstantiatorfindValueInstantiator(DeserializationConfig config, BasicBeanDescription beanDesc)Value instantiator is created both based on creator annotations, and on optional externally provided instantiators (registered through module interface).DeserializerFactory.ConfiggetConfig()protected booleanisIgnorableType(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.Class<?> type, java.util.Map<java.lang.Class<?>,java.lang.Boolean> ignoredTypes)Helper method that will check whether given raw type is marked as always ignorable (for purpose of ignoring properties with type)protected booleanisPotentialBeanType(java.lang.Class<?> type)Helper method used to skip processing for types that we know can not be (i.e.JavaTypemapAbstractType(DeserializationConfig config, JavaType type)Method that will find complete abstract type mapping for specified type, doing as many resolution steps as necessary.protected JavaTypematerializeAbstractType(DeserializationConfig config, BasicBeanDescription beanDesc)DeserializerFactorywithConfig(DeserializerFactory.Config config)Method used by module registration functionality, to construct a new bean deserializer factory with different configuration settings.-
Methods inherited from class org.codehaus.jackson.map.deser.BasicDeserializerFactory
constructEnumResolver, createArrayDeserializer, createCollectionDeserializer, createCollectionLikeDeserializer, createEnumDeserializer, createMapDeserializer, createMapLikeDeserializer, createTreeDeserializer, findDeserializerFromAnnotation, findPropertyContentTypeDeserializer, findPropertyTypeDeserializer, findStdBeanDeserializer, findTypeDeserializer, modifyTypeByAnnotation, resolveType
-
Methods inherited from class org.codehaus.jackson.map.DeserializerFactory
withAbstractTypeResolver, withAdditionalDeserializers, withAdditionalKeyDeserializers, withDeserializerModifier, withValueInstantiators
-
-
-
-
Field Detail
-
instance
public static final BeanDeserializerFactory instance
Globally shareable thread-safe instance which has no additional custom deserializers registered
-
_factoryConfig
protected final DeserializerFactory.Config _factoryConfig
Configuration settings for this factory; immutable instance (just like this factory), new version created via copy-constructor (fluent-style)- Since:
- 1.7
-
-
Constructor Detail
-
BeanDeserializerFactory
@Deprecated public BeanDeserializerFactory()
Deprecated.
-
BeanDeserializerFactory
public BeanDeserializerFactory(DeserializerFactory.Config config)
- Since:
- 1.7
-
-
Method Detail
-
getConfig
public final DeserializerFactory.Config getConfig()
- Specified by:
getConfigin classDeserializerFactory
-
withConfig
public DeserializerFactory withConfig(DeserializerFactory.Config config)
Method used by module registration functionality, to construct a new bean deserializer factory with different configuration settings.- Specified by:
withConfigin classBasicDeserializerFactory- Since:
- 1.7
-
createKeyDeserializer
public KeyDeserializer createKeyDeserializer(DeserializationConfig config, JavaType type, BeanProperty property) throws JsonMappingException
Description copied from class:DeserializerFactoryMethod called to find if factory knows how to create a key deserializer for specified type; currently this means checking if a module has registered possible deserializers.- Overrides:
createKeyDeserializerin classDeserializerFactory- Returns:
- Key deserializer to use for specified type, if one found; null if not (and default key deserializer should be used)
- Throws:
JsonMappingException
-
_findCustomArrayDeserializer
protected JsonDeserializer<?> _findCustomArrayDeserializer(ArrayType type, DeserializationConfig config, DeserializerProvider provider, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
- Specified by:
_findCustomArrayDeserializerin classBasicDeserializerFactory- Throws:
JsonMappingException
-
_findCustomCollectionDeserializer
protected JsonDeserializer<?> _findCustomCollectionDeserializer(CollectionType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
- Specified by:
_findCustomCollectionDeserializerin classBasicDeserializerFactory- Throws:
JsonMappingException
-
_findCustomCollectionLikeDeserializer
protected JsonDeserializer<?> _findCustomCollectionLikeDeserializer(CollectionLikeType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
- Specified by:
_findCustomCollectionLikeDeserializerin classBasicDeserializerFactory- Throws:
JsonMappingException
-
_findCustomEnumDeserializer
protected JsonDeserializer<?> _findCustomEnumDeserializer(java.lang.Class<?> type, DeserializationConfig config, BasicBeanDescription beanDesc, BeanProperty property) throws JsonMappingException
- Specified by:
_findCustomEnumDeserializerin classBasicDeserializerFactory- Throws:
JsonMappingException
-
_findCustomMapDeserializer
protected JsonDeserializer<?> _findCustomMapDeserializer(MapType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
- Specified by:
_findCustomMapDeserializerin classBasicDeserializerFactory- Throws:
JsonMappingException
-
_findCustomMapLikeDeserializer
protected JsonDeserializer<?> _findCustomMapLikeDeserializer(MapLikeType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
- Specified by:
_findCustomMapLikeDeserializerin classBasicDeserializerFactory- Throws:
JsonMappingException
-
_findCustomTreeNodeDeserializer
protected JsonDeserializer<?> _findCustomTreeNodeDeserializer(java.lang.Class<? extends JsonNode> type, DeserializationConfig config, BeanProperty property) throws JsonMappingException
- Specified by:
_findCustomTreeNodeDeserializerin classBasicDeserializerFactory- Throws:
JsonMappingException
-
_findCustomBeanDeserializer
protected JsonDeserializer<java.lang.Object> _findCustomBeanDeserializer(JavaType type, DeserializationConfig config, DeserializerProvider provider, BasicBeanDescription beanDesc, BeanProperty property) throws JsonMappingException
- Throws:
JsonMappingException
-
mapAbstractType
public JavaType mapAbstractType(DeserializationConfig config, JavaType type) throws JsonMappingException
Method that will find complete abstract type mapping for specified type, doing as many resolution steps as necessary.- Specified by:
mapAbstractTypein classBasicDeserializerFactory- Throws:
JsonMappingException
-
findValueInstantiator
public ValueInstantiator findValueInstantiator(DeserializationConfig config, BasicBeanDescription beanDesc) throws JsonMappingException
Value instantiator is created both based on creator annotations, and on optional externally provided instantiators (registered through module interface).- Specified by:
findValueInstantiatorin classBasicDeserializerFactory- Throws:
JsonMappingException
-
createBeanDeserializer
public JsonDeserializer<java.lang.Object> createBeanDeserializer(DeserializationConfig config, DeserializerProvider p, JavaType type, BeanProperty property) throws JsonMappingException
Method thatDeserializerProviders call to create a new deserializer for types other than Collections, Maps, arrays and enums.- Specified by:
createBeanDeserializerin classDeserializerFactoryp- Provider that can be called to create deserializers for contained member typestype- Type to be deserialized- Throws:
JsonMappingException
-
_mapAbstractType2
protected JavaType _mapAbstractType2(DeserializationConfig config, JavaType type) throws JsonMappingException
Method that will find abstract type mapping for specified type, doing a single lookup through registered abstract type resolvers; will not do recursive lookups.- Throws:
JsonMappingException
-
materializeAbstractType
protected JavaType materializeAbstractType(DeserializationConfig config, BasicBeanDescription beanDesc) throws JsonMappingException
- Throws:
JsonMappingException
-
buildBeanDeserializer
public JsonDeserializer<java.lang.Object> buildBeanDeserializer(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc, BeanProperty property) throws JsonMappingException
Method that is to actually build a bean deserializer instance. All basic sanity checks have been done to know that what we have may be a valid bean type, and that there are no default simple deserializers.- Throws:
JsonMappingException
-
buildThrowableDeserializer
public JsonDeserializer<java.lang.Object> buildThrowableDeserializer(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc, BeanProperty property) throws JsonMappingException
- Throws:
JsonMappingException
-
constructBeanDeserializerBuilder
protected BeanDeserializerBuilder constructBeanDeserializerBuilder(BasicBeanDescription beanDesc)
Overridable method that constructs aBeanDeserializerBuilderwhich is used to accumulate information needed to create deserializer instance.- Since:
- 1.7
-
constructDefaultValueInstantiator
protected ValueInstantiator constructDefaultValueInstantiator(DeserializationConfig config, BasicBeanDescription beanDesc) throws JsonMappingException
Method that will construct standard defaultValueInstantiatorusing annotations (like @JsonCreator) and visibility rules- Throws:
JsonMappingException- Since:
- 1.9
-
_addDeserializerConstructors
protected void _addDeserializerConstructors(DeserializationConfig config, BasicBeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators) throws JsonMappingException
- Throws:
JsonMappingException
-
_handleSingleArgumentConstructor
protected boolean _handleSingleArgumentConstructor(DeserializationConfig config, BasicBeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, AnnotatedConstructor ctor, boolean isCreator, boolean isVisible) throws JsonMappingException
- Throws:
JsonMappingException
-
_addDeserializerFactoryMethods
protected void _addDeserializerFactoryMethods(DeserializationConfig config, BasicBeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators) throws JsonMappingException
- Throws:
JsonMappingException
-
_handleSingleArgumentFactory
protected boolean _handleSingleArgumentFactory(DeserializationConfig config, BasicBeanDescription beanDesc, VisibilityChecker<?> vchecker, AnnotationIntrospector intr, CreatorCollector creators, AnnotatedMethod factory, boolean isCreator) throws JsonMappingException
- Throws:
JsonMappingException
-
constructCreatorProperty
protected CreatorProperty constructCreatorProperty(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.String name, int index, AnnotatedParameter param, java.lang.Object injectableValueId) throws JsonMappingException
Method that will construct a property object that represents a logical property passed via Creator (constructor or static factory method)- Throws:
JsonMappingException
-
addBeanProps
protected void addBeanProps(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException
Method called to figure out settable properties for the bean deserializer to use.Note: designed to be overridable, and effort is made to keep interface similar between versions.
- Throws:
JsonMappingException
-
addReferenceProperties
protected void addReferenceProperties(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException
Method that will find if bean has any managed- or back-reference properties, and if so add them to bean, to be linked during resolution phase.- Throws:
JsonMappingException- Since:
- 1.6
-
addInjectables
protected void addInjectables(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException
Method called locate all members used for value injection (if any), constructorValueInjectorinstances, and add them to builder.- Throws:
JsonMappingException- Since:
- 1.9
-
constructAnySetter
protected SettableAnyProperty constructAnySetter(DeserializationConfig config, BasicBeanDescription beanDesc, AnnotatedMethod setter) throws JsonMappingException
Method called to construct fallbackSettableAnyPropertyfor handling unknown bean properties, given a method that has been designated as such setter.- Throws:
JsonMappingException
-
constructSettableProperty
protected SettableBeanProperty constructSettableProperty(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.String name, AnnotatedMethod setter) throws JsonMappingException
Method that will construct a regular bean property setter using the given setter method.- Parameters:
setter- Method to use to set property value; or null if none. Null only for "setterless" properties- Returns:
- Property constructed, if any; or null to indicate that there should be no property based on given definitions.
- Throws:
JsonMappingException
-
constructSettableProperty
protected SettableBeanProperty constructSettableProperty(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.String name, AnnotatedField field) throws JsonMappingException
- Throws:
JsonMappingException
-
constructSetterlessProperty
protected SettableBeanProperty constructSetterlessProperty(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.String name, AnnotatedMethod getter) throws JsonMappingException
Method that will construct a regular bean property setter using the given setter method.- Parameters:
getter- Method to use to get property value to modify, null if none. Non-null for "setterless" properties.- Throws:
JsonMappingException
-
isPotentialBeanType
protected boolean isPotentialBeanType(java.lang.Class<?> type)
Helper method used to skip processing for types that we know can not be (i.e. are never consider to be) beans: things like primitives, Arrays, Enums, and proxy types.Note that usually we shouldn't really be getting these sort of types anyway; but better safe than sorry.
-
isIgnorableType
protected boolean isIgnorableType(DeserializationConfig config, BasicBeanDescription beanDesc, java.lang.Class<?> type, java.util.Map<java.lang.Class<?>,java.lang.Boolean> ignoredTypes)
Helper method that will check whether given raw type is marked as always ignorable (for purpose of ignoring properties with type)
-
-