public class SimpleDeserializers extends Deserializers.Base implements Serializable
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 Maps and Collections
or array types).
Unlike SimpleSerializers, this class does not currently support generic mappings;
all mappings must be to exact declared deserialization type.
Deserializers.Base| Modifier and Type | Field and Description |
|---|---|
protected HashMap<ClassKey,JsonDeserializer<?>> |
_classMappings |
protected boolean |
_hasEnumDeserializer
Flag to help find "generic" enum deserializer, if one has been registered.
|
| Constructor and Description |
|---|
SimpleDeserializers() |
SimpleDeserializers(Map<Class<?>,JsonDeserializer<?>> desers) |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addDeserializer(Class<T> forClass,
JsonDeserializer<? extends T> deser) |
void |
addDeserializers(Map<Class<?>,JsonDeserializer<?>> desers) |
JsonDeserializer<?> |
findArrayDeserializer(ArrayType type,
DeserializationConfig config,
BeanDescription beanDesc,
TypeDeserializer elementTypeDeserializer,
JsonDeserializer<?> elementDeserializer)
Method called to locate serializer for specified array type.
|
JsonDeserializer<?> |
findBeanDeserializer(JavaType type,
DeserializationConfig config,
BeanDescription beanDesc)
Method called to locate deserializer for specified value type which does not belong to any other
category (not an Enum, Collection, Map, Array, reference value or tree node)
|
JsonDeserializer<?> |
findCollectionDeserializer(CollectionType type,
DeserializationConfig config,
BeanDescription beanDesc,
TypeDeserializer elementTypeDeserializer,
JsonDeserializer<?> elementDeserializer)
Method called to locate serializer for specified
Collection (List, Set etc) type. |
JsonDeserializer<?> |
findCollectionLikeDeserializer(CollectionLikeType type,
DeserializationConfig config,
BeanDescription beanDesc,
TypeDeserializer elementTypeDeserializer,
JsonDeserializer<?> elementDeserializer)
Method called to locate serializer for specified
"Collection-like" type (one that acts
like
Collection but does not implement it). |
JsonDeserializer<?> |
findEnumDeserializer(Class<?> type,
DeserializationConfig config,
BeanDescription beanDesc)
Method called to locate deserializer for specified
Enum type. |
JsonDeserializer<?> |
findMapDeserializer(MapType type,
DeserializationConfig config,
BeanDescription beanDesc,
KeyDeserializer keyDeserializer,
TypeDeserializer elementTypeDeserializer,
JsonDeserializer<?> elementDeserializer)
Method called to locate deserializer for specified
Map type. |
JsonDeserializer<?> |
findMapLikeDeserializer(MapLikeType type,
DeserializationConfig config,
BeanDescription beanDesc,
KeyDeserializer keyDeserializer,
TypeDeserializer elementTypeDeserializer,
JsonDeserializer<?> elementDeserializer)
Method called to locate serializer for specified
"Map-like" type (one that acts
like
Map but does not implement it). |
JsonDeserializer<?> |
findReferenceDeserializer(ReferenceType refType,
DeserializationConfig config,
BeanDescription beanDesc,
TypeDeserializer contentTypeDeserializer,
JsonDeserializer<?> contentDeserializer)
Method called to locate deserializer for value that is of referential
type,
|
JsonDeserializer<?> |
findTreeNodeDeserializer(Class<? extends JsonNode> nodeType,
DeserializationConfig config,
BeanDescription beanDesc)
Method called to locate deserializer for specified JSON tree node type.
|
boolean |
hasDeserializerFor(DeserializationConfig config,
Class<?> valueType)
Method that may be called to check whether this deserializer provider would provide
deserializer for values of given type, without attempting to construct (and possibly
fail in some cases) actual deserializer.
|
protected HashMap<ClassKey,JsonDeserializer<?>> _classMappings
protected boolean _hasEnumDeserializer
public SimpleDeserializers()
public SimpleDeserializers(Map<Class<?>,JsonDeserializer<?>> desers)
public <T> void addDeserializer(Class<T> forClass, JsonDeserializer<? extends T> deser)
public void addDeserializers(Map<Class<?>,JsonDeserializer<?>> desers)
public JsonDeserializer<?> findArrayDeserializer(ArrayType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
DeserializersDeserializer 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).
findArrayDeserializer in interface DeserializersfindArrayDeserializer in class Deserializers.Basetype - Type of array instances to deserializeconfig - Configuration in effectbeanDesc - Definition of the enumeration type that contains class annotations and
other information typically needed for building deserializerselementTypeDeserializer - 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 using
ResolvableDeserializer callback)JsonMappingExceptionpublic JsonDeserializer<?> findBeanDeserializer(JavaType type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException
DeserializersfindBeanDeserializer in interface DeserializersfindBeanDeserializer in class Deserializers.Basetype - Bean type to deserializeconfig - Configuration in effectbeanDesc - Definition of the enumeration type that contains class annotations and
other information typically needed for building deserializersJsonMappingExceptionpublic JsonDeserializer<?> findCollectionDeserializer(CollectionType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
DeserializersCollection (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).
findCollectionDeserializer in interface DeserializersfindCollectionDeserializer in class Deserializers.Basetype - Type of collection instances to deserializeconfig - Configuration in effectbeanDesc - Definition of the enumeration type that contains class annotations and
other information typically needed for building deserializerselementTypeDeserializer - 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 using
ResolvableDeserializer callback)JsonMappingExceptionpublic JsonDeserializer<?> findCollectionLikeDeserializer(CollectionLikeType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
DeserializersCollection 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).
findCollectionLikeDeserializer in interface DeserializersfindCollectionLikeDeserializer in class Deserializers.Basetype - Type of instances to deserializeconfig - Configuration in effectbeanDesc - Definition of the enumeration type that contains class annotations and
other information typically needed for building deserializerselementTypeDeserializer - 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 using
ResolvableDeserializer callback)JsonMappingExceptionpublic JsonDeserializer<?> findEnumDeserializer(Class<?> type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException
DeserializersEnum type.findEnumDeserializer in interface DeserializersfindEnumDeserializer in class Deserializers.Basetype - Type of Enum instances to deserializeconfig - Configuration in effectbeanDesc - Definition of the enumeration type that contains class annotations and
other information typically needed for building deserializersJsonMappingExceptionpublic JsonDeserializer<?> findTreeNodeDeserializer(Class<? extends JsonNode> nodeType, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException
DeserializersfindTreeNodeDeserializer in interface DeserializersfindTreeNodeDeserializer in class Deserializers.BasenodeType - Specific type of JSON tree nodes to deserialize
(subtype of JsonNode)config - Configuration in effectJsonMappingExceptionpublic JsonDeserializer<?> findReferenceDeserializer(ReferenceType refType, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer contentTypeDeserializer, JsonDeserializer<?> contentDeserializer) throws JsonMappingException
DeserializersfindReferenceDeserializer in interface DeserializersfindReferenceDeserializer in class Deserializers.BaserefType - Specific referential type to deserializeconfig - Configuration in effectbeanDesc - Definition of the reference type that contains class annotations and
other information typically needed for building deserializerscontentTypeDeserializer - Possible type deserializer for referenced valuecontentDeserializer - Value deserializer to use for referenced value, if indicated
by property annotationJsonMappingExceptionpublic JsonDeserializer<?> findMapDeserializer(MapType type, DeserializationConfig config, BeanDescription beanDesc, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
DeserializersMap 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 later during
resolution (using ResolvableDeserializer.resolve(com.fasterxml.jackson.databind.DeserializationContext)).
findMapDeserializer in interface DeserializersfindMapDeserializer in class Deserializers.Basetype - Type of Map instances to deserializeconfig - Configuration in effectbeanDesc - Definition of the enumeration type that contains class annotations and
other information typically needed for building deserializerskeyDeserializer - 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 using
ResolvableDeserializer callback)JsonMappingExceptionpublic JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type, DeserializationConfig config, BeanDescription beanDesc, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
DeserializersMap 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 later during
resolution (using ResolvableDeserializer.resolve(com.fasterxml.jackson.databind.DeserializationContext)).
findMapLikeDeserializer in interface DeserializersfindMapLikeDeserializer in class Deserializers.Basetype - Type of Map instances to deserializeconfig - Configuration in effectbeanDesc - Definition of the enumeration type that contains class annotations and
other information typically needed for building deserializerskeyDeserializer - 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 using
ResolvableDeserializer callback)JsonMappingExceptionpublic boolean hasDeserializerFor(DeserializationConfig config, Class<?> valueType)
Deserializers.BaseNote: implementations should take care NOT to claim supporting types that they do not recognize as this could to incorrect assumption of safe support by caller.
Method added in this implementation since adding new methods for interfaces before Java 8 is not a good idea: will be added in Jackson 3.0 for `Deserializers`.
hasDeserializerFor in class Deserializers.BaseCopyright © 2008–2020 FasterXML. All rights reserved.