Class SimpleDeserializers
- All Implemented Interfaces:
Deserializers
Deserializers
which allows registration of
deserializers based on raw (type erased class).
It can work well for basic bean and scalar type deserializers, but is not
a good fit for handling generic types (like Map
s and Collection
s
or array types).
Unlike SimpleSerializers
, this class does not currently support generic mappings;
all mappings must be to exact declared deserialization type.
- Since:
- 1.7
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.codehaus.jackson.map.Deserializers
Deserializers.Base, Deserializers.None
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> void
addDeserializer
(Class<T> forClass, JsonDeserializer<? extends T> deser) findArrayDeserializer
(ArrayType type, DeserializationConfig config, DeserializerProvider provider, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) Method called to locate serializer for specified array type.findBeanDeserializer
(JavaType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property) Method called to locate deserializer for specified value type which does not belong to any other category (not an Enum, Collection, Map, Array or tree node)findCollectionDeserializer
(CollectionType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) Method called to locate serializer for specifiedCollection
(List, Set etc) type.findCollectionLikeDeserializer
(CollectionLikeType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) Method called to locate serializer for specified "Collection-like" type (one that acts likeCollection
but does not implement it).findEnumDeserializer
(Class<?> type, DeserializationConfig config, BeanDescription beanDesc, BeanProperty property) Method called to locate deserializer for specifiedEnum
type.findMapDeserializer
(MapType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) Method called to locate deserializer for specifiedMap
type.findMapLikeDeserializer
(MapLikeType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) Method called to locate serializer for specified "Map-like" type (one that acts likeMap
but does not implement it).findTreeNodeDeserializer
(Class<? extends JsonNode> nodeType, DeserializationConfig config, BeanProperty property) Method called to locate deserializer for specified JSON tree node type.
-
Field Details
-
_classMappings
-
-
Constructor Details
-
SimpleDeserializers
public SimpleDeserializers()
-
-
Method Details
-
addDeserializer
-
findArrayDeserializer
public JsonDeserializer<?> findArrayDeserializer(ArrayType type, DeserializationConfig config, DeserializerProvider provider, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException Description copied from interface:Deserializers
Method called to locate serializer for specified array type.Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).
- Specified by:
findArrayDeserializer
in interfaceDeserializers
- Parameters:
type
- Type of array instances to deserializeconfig
- Configuration in effectprovider
- Provider that can be used to locate deserializer for component type (if one not provided, or needs to be overridden)property
- Property that contains array value (null for root values)elementTypeDeserializer
- If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.elementDeserializer
- Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or usingResolvableDeserializer
callback)- Returns:
- Deserializer to use for the type; or null if this provider does not know how to construct it
- Throws:
JsonMappingException
-
findBeanDeserializer
public JsonDeserializer<?> findBeanDeserializer(JavaType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property) throws JsonMappingException Description copied from interface:Deserializers
Method called to locate deserializer for specified value type which does not belong to any other category (not an Enum, Collection, Map, Array or tree node)- Specified by:
findBeanDeserializer
in interfaceDeserializers
- Parameters:
type
- Bean type to deserializeconfig
- Configuration in effectprovider
- Provider that can be used to locate dependant deserializers if and as necessary (but note that in many cases resolution must be deferred by usingResolvableDeserializer
callback)beanDesc
- Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers (note: always instance ofBasicBeanDescription
)- Returns:
- Deserializer to use for the type; or null if this provider does not know how to construct it
- Throws:
JsonMappingException
-
findCollectionDeserializer
public JsonDeserializer<?> findCollectionDeserializer(CollectionType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException Description copied from interface:Deserializers
Method called to locate serializer for specifiedCollection
(List, Set etc) type.Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).
- Specified by:
findCollectionDeserializer
in interfaceDeserializers
- Parameters:
type
- Type of collection instances to deserializeconfig
- Configuration in effectprovider
- Provider that can be used to locate dependant deserializers if and as necessary (but note that in many cases resolution must be deferred by usingResolvableDeserializer
callback)beanDesc
- Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers (note: always instance ofBasicBeanDescription
)property
- Property that contains array value (null for root values)elementTypeDeserializer
- If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.elementDeserializer
- Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or usingResolvableDeserializer
callback)- Returns:
- Deserializer to use for the type; or null if this provider does not know how to construct it
- Throws:
JsonMappingException
-
findCollectionLikeDeserializer
public JsonDeserializer<?> findCollectionLikeDeserializer(CollectionLikeType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException Description copied from interface:Deserializers
Method called to locate serializer for specified "Collection-like" type (one that acts likeCollection
but does not implement it).Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).
- Specified by:
findCollectionLikeDeserializer
in interfaceDeserializers
- Parameters:
type
- Type of instances to deserializeconfig
- Configuration in effectprovider
- Provider that can be used to locate dependant deserializers if and as necessary (but note that in many cases resolution must be deferred by usingResolvableDeserializer
callback)beanDesc
- Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers (note: always instance ofBasicBeanDescription
)property
- Property that contains array value (null for root values)elementTypeDeserializer
- If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.elementDeserializer
- Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or usingResolvableDeserializer
callback)- Returns:
- Deserializer to use for the type; or null if this provider does not know how to construct it
- Throws:
JsonMappingException
-
findEnumDeserializer
public JsonDeserializer<?> findEnumDeserializer(Class<?> type, DeserializationConfig config, BeanDescription beanDesc, BeanProperty property) throws JsonMappingException Description copied from interface:Deserializers
Method called to locate deserializer for specifiedEnum
type.- Specified by:
findEnumDeserializer
in interfaceDeserializers
- Parameters:
type
- Type ofEnum
instances to deserializeconfig
- Configuration in effectbeanDesc
- Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers (note: always instance ofBasicBeanDescription
)- Returns:
- Deserializer to use for the type; or null if this provider does not know how to construct it
- Throws:
JsonMappingException
-
findMapDeserializer
public JsonDeserializer<?> findMapDeserializer(MapType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException Description copied from interface:Deserializers
Method called to locate deserializer for specifiedMap
type.Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).
Similarly, a
KeyDeserializer
may be passed, but this is only done if there is a specific configuration override (annotations) to indicate instance to use. Otherwise null is passed, and key deserializer needs to be obtained usingDeserializerProvider
- Specified by:
findMapDeserializer
in interfaceDeserializers
- Parameters:
type
- Type ofMap
instances to deserializeconfig
- Configuration in effectprovider
- Provider that can be used to locate dependant deserializers if and as necessary (but note that in many cases resolution must be deferred by usingResolvableDeserializer
callback)beanDesc
- Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers (note: always instance ofBasicBeanDescription
)keyDeserializer
- Key deserializer use, if it is defined via annotations or other configuration; null if default key deserializer for key type can be used.elementTypeDeserializer
- If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.elementDeserializer
- Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or usingResolvableDeserializer
callback)- Returns:
- Deserializer to use for the type; or null if this provider does not know how to construct it
- Throws:
JsonMappingException
-
findMapLikeDeserializer
public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException Description copied from interface:Deserializers
Method called to locate serializer for specified "Map-like" type (one that acts likeMap
but does not implement it).Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).
Similarly, a
KeyDeserializer
may be passed, but this is only done if there is a specific configuration override (annotations) to indicate instance to use. Otherwise null is passed, and key deserializer needs to be obtained usingDeserializerProvider
- Specified by:
findMapLikeDeserializer
in interfaceDeserializers
- Parameters:
type
- Type ofMap
instances to deserializeconfig
- Configuration in effectprovider
- Provider that can be used to locate dependant deserializers if and as necessary (but note that in many cases resolution must be deferred by usingResolvableDeserializer
callback)beanDesc
- Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers (note: always instance ofBasicBeanDescription
)keyDeserializer
- Key deserializer use, if it is defined via annotations or other configuration; null if default key deserializer for key type can be used.elementTypeDeserializer
- If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.elementDeserializer
- Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or usingResolvableDeserializer
callback)- Returns:
- Deserializer to use for the type; or null if this provider does not know how to construct it
- Throws:
JsonMappingException
-
findTreeNodeDeserializer
public JsonDeserializer<?> findTreeNodeDeserializer(Class<? extends JsonNode> nodeType, DeserializationConfig config, BeanProperty property) throws JsonMappingException Description copied from interface:Deserializers
Method called to locate deserializer for specified JSON tree node type.- Specified by:
findTreeNodeDeserializer
in interfaceDeserializers
- Parameters:
nodeType
- Specific type of JSON tree nodes to deserialize (subtype ofJsonNode
)config
- Configuration in effect- Returns:
- Deserializer to use for the type; or null if this provider does not know how to construct it
- Throws:
JsonMappingException
-