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
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 by
DeserializerProvider
s).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Standard configuration settings container class implementation.Nested classes/interfaces inherited from class org.codehaus.jackson.map.DeserializerFactory
DeserializerFactory.Config
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DeserializerFactory.Config
Configuration settings for this factory; immutable instance (just like this factory), new version created via copy-constructor (fluent-style)static final BeanDeserializerFactory
Globally shareable thread-safe instance which has no additional custom deserializers registeredFields inherited from class org.codehaus.jackson.map.deser.BasicDeserializerFactory
_arrayDeserializers, optionalHandlers
Fields inherited from class org.codehaus.jackson.map.DeserializerFactory
NO_DESERIALIZERS
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
<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
(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
(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 void
addBeanProps
(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder) Method called to figure out settable properties for the bean deserializer to use.protected void
addInjectables
(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder) Method called locate all members used for value injection (if any), constructorValueInjector
instances, and add them to builder.protected void
addReferenceProperties
(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.buildBeanDeserializer
(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc, BeanProperty property) Method that is to actually build a bean deserializer instance.buildThrowableDeserializer
(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc, BeanProperty property) protected SettableAnyProperty
constructAnySetter
(DeserializationConfig config, BasicBeanDescription beanDesc, AnnotatedMethod setter) Method called to construct fallbackSettableAnyProperty
for handling unknown bean properties, given a method that has been designated as such setter.protected BeanDeserializerBuilder
Overridable method that constructs aBeanDeserializerBuilder
which is used to accumulate information needed to create deserializer instance.protected CreatorProperty
constructCreatorProperty
(DeserializationConfig config, BasicBeanDescription beanDesc, String name, int index, AnnotatedParameter param, Object injectableValueId) Method that will construct a property object that represents a logical property passed via Creator (constructor or static factory method)protected ValueInstantiator
constructDefaultValueInstantiator
(DeserializationConfig config, BasicBeanDescription beanDesc) Method that will construct standard defaultValueInstantiator
using annotations (like @JsonCreator) and visibility rulesprotected SettableBeanProperty
constructSettableProperty
(DeserializationConfig config, BasicBeanDescription beanDesc, String name, AnnotatedField field) protected SettableBeanProperty
constructSettableProperty
(DeserializationConfig config, BasicBeanDescription beanDesc, String name, AnnotatedMethod setter) Method that will construct a regular bean property setter using the given setter method.protected SettableBeanProperty
constructSetterlessProperty
(DeserializationConfig config, BasicBeanDescription beanDesc, String name, AnnotatedMethod getter) Method that will construct a regular bean property setter using the given setter method.createBeanDeserializer
(DeserializationConfig config, DeserializerProvider p, JavaType type, BeanProperty property) Method thatDeserializerProvider
s call to create a new deserializer for types other than Collections, Maps, arrays and enums.createKeyDeserializer
(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.findValueInstantiator
(DeserializationConfig config, BasicBeanDescription beanDesc) Value instantiator is created both based on creator annotations, and on optional externally provided instantiators (registered through module interface).protected boolean
isIgnorableType
(DeserializationConfig config, BasicBeanDescription beanDesc, Class<?> type, Map<Class<?>, Boolean> ignoredTypes) Helper method that will check whether given raw type is marked as always ignorable (for purpose of ignoring properties with type)protected boolean
isPotentialBeanType
(Class<?> type) Helper method used to skip processing for types that we know can not be (i.e.mapAbstractType
(DeserializationConfig config, JavaType type) Method that will find complete abstract type mapping for specified type, doing as many resolution steps as necessary.protected JavaType
materializeAbstractType
(DeserializationConfig config, BasicBeanDescription beanDesc) withConfig
(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 Details
-
instance
Globally shareable thread-safe instance which has no additional custom deserializers registered -
_factoryConfig
Configuration settings for this factory; immutable instance (just like this factory), new version created via copy-constructor (fluent-style)- Since:
- 1.7
-
-
Constructor Details
-
BeanDeserializerFactory
Deprecated. -
BeanDeserializerFactory
- Since:
- 1.7
-
-
Method Details
-
getConfig
- Specified by:
getConfig
in classDeserializerFactory
-
withConfig
Method used by module registration functionality, to construct a new bean deserializer factory with different configuration settings.- Specified by:
withConfig
in classBasicDeserializerFactory
- Since:
- 1.7
-
createKeyDeserializer
public KeyDeserializer createKeyDeserializer(DeserializationConfig config, JavaType type, BeanProperty property) throws JsonMappingException Description copied from class:DeserializerFactory
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.- Overrides:
createKeyDeserializer
in 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:
_findCustomArrayDeserializer
in 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:
_findCustomCollectionDeserializer
in 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:
_findCustomCollectionLikeDeserializer
in classBasicDeserializerFactory
- Throws:
JsonMappingException
-
_findCustomEnumDeserializer
protected JsonDeserializer<?> _findCustomEnumDeserializer(Class<?> type, DeserializationConfig config, BasicBeanDescription beanDesc, BeanProperty property) throws JsonMappingException - Specified by:
_findCustomEnumDeserializer
in 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:
_findCustomMapDeserializer
in 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:
_findCustomMapLikeDeserializer
in classBasicDeserializerFactory
- Throws:
JsonMappingException
-
_findCustomTreeNodeDeserializer
protected JsonDeserializer<?> _findCustomTreeNodeDeserializer(Class<? extends JsonNode> type, DeserializationConfig config, BeanProperty property) throws JsonMappingException - Specified by:
_findCustomTreeNodeDeserializer
in classBasicDeserializerFactory
- Throws:
JsonMappingException
-
_findCustomBeanDeserializer
protected JsonDeserializer<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:
mapAbstractType
in 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:
findValueInstantiator
in classBasicDeserializerFactory
- Throws:
JsonMappingException
-
createBeanDeserializer
public JsonDeserializer<Object> createBeanDeserializer(DeserializationConfig config, DeserializerProvider p, JavaType type, BeanProperty property) throws JsonMappingException Method thatDeserializerProvider
s call to create a new deserializer for types other than Collections, Maps, arrays and enums.- Specified by:
createBeanDeserializer
in classDeserializerFactory
- Parameters:
p
- 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<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<Object> buildThrowableDeserializer(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc, BeanProperty property) throws JsonMappingException - Throws:
JsonMappingException
-
constructBeanDeserializerBuilder
Overridable method that constructs aBeanDeserializerBuilder
which 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 defaultValueInstantiator
using 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, String name, int index, AnnotatedParameter param, 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), constructorValueInjector
instances, 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 fallbackSettableAnyProperty
for handling unknown bean properties, given a method that has been designated as such setter.- Throws:
JsonMappingException
-
constructSettableProperty
protected SettableBeanProperty constructSettableProperty(DeserializationConfig config, BasicBeanDescription beanDesc, 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, String name, AnnotatedField field) throws JsonMappingException - Throws:
JsonMappingException
-
constructSetterlessProperty
protected SettableBeanProperty constructSetterlessProperty(DeserializationConfig config, BasicBeanDescription beanDesc, 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
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, Class<?> type, Map<Class<?>, Boolean> ignoredTypes) Helper method that will check whether given raw type is marked as always ignorable (for purpose of ignoring properties with type)
-