|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.DeserializerFactory
org.codehaus.jackson.map.deser.BasicDeserializerFactory
org.codehaus.jackson.map.deser.BeanDeserializerFactory
org.codehaus.jackson.map.deser.CustomDeserializerFactory
public class CustomDeserializerFactory
Deserializer factory implementation that allows for configuring
mapping between types and deserializers to use, by using
multiple types of overrides. Existing mappings established by
BeanDeserializerFactory
(and its super class,
BasicDeserializerFactory
) are used if no overrides are
defined.
Unlike base deserializer factories, this factory is stateful because of configuration settings. It is thread-safe, however, as long as all configuration as done before using the factory -- a single instance can be shared between providers and mappers.
Configurations currently available are:
In near future, following features are planned to be added:
Field Summary |
---|
Fields inherited from class org.codehaus.jackson.map.deser.BeanDeserializerFactory |
---|
instance |
Constructor Summary | |
---|---|
CustomDeserializerFactory()
|
Method Summary | ||
---|---|---|
void |
addMixInAnnotationMapping(Class<?> destinationClass,
Class<?> classWithMixIns)
Method to use for adding mix-in annotations that Class classWithMixIns contains into class
destinationClass . |
|
|
addSpecificMapping(Class<T> forClass,
JsonDeserializer<? extends T> deser)
Method used to add a mapping for specific type -- and only that type -- to use specified deserializer. |
|
JsonDeserializer<Object> |
createBeanDeserializer(DeserializationConfig config,
JavaType type,
DeserializerProvider p)
Method that DeserializerProvider s call to create a new
deserializer for types other than Collections, Maps, arrays and
enums. |
|
JsonDeserializer<?> |
createEnumDeserializer(DeserializationConfig config,
Class<?> enumClass,
DeserializerProvider p)
Factory method for constructing serializers of Enum types. |
Methods inherited from class org.codehaus.jackson.map.deser.BasicDeserializerFactory |
---|
constructCreatorProperty, createArrayDeserializer, createCollectionDeserializer, createMapDeserializer, createTreeDeserializer, findDeserializerFromAnnotation, findPropertyContentTypeDeserializer, findPropertyTypeDeserializer, findTypeDeserializer, modifyTypeByAnnotation, resolveType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CustomDeserializerFactory()
Method Detail |
---|
public <T> void addSpecificMapping(Class<T> forClass, JsonDeserializer<? extends T> deser)
Note that both class and interfaces can be mapped, since the type is derived from method declarations; and hence may be abstract types and interfaces. This is different from custom serialization where only class types can be directly mapped.
forClass
- Class to deserialize using specific deserializer.deser
- Deserializer to use for the class. Declared type for
deserializer may be more specific (sub-class) than declared class
to map, since that will still be compatible (deserializer produces
sub-class which is assignable to field/method)public void addMixInAnnotationMapping(Class<?> destinationClass, Class<?> classWithMixIns)
classWithMixIns
contains into class
destinationClass
. Mixing in is done when introspecting
class annotations and properties.
Annotations from classWithMixIns
(and its supertypes)
will override
anything destinationClass
(and its super-types)
has already.
destinationClass
- Class to modify by adding annotationsclassWithMixIns
- Class that contains annotations to addpublic JsonDeserializer<Object> createBeanDeserializer(DeserializationConfig config, JavaType type, DeserializerProvider p) throws JsonMappingException
BeanDeserializerFactory
DeserializerProvider
s call to create a new
deserializer for types other than Collections, Maps, arrays and
enums.
createBeanDeserializer
in class BeanDeserializerFactory
type
- Type to be deserializedp
- Provider that can be called to create deserializers for
contained member types
JsonMappingException
public JsonDeserializer<?> createEnumDeserializer(DeserializationConfig config, Class<?> enumClass, DeserializerProvider p) throws JsonMappingException
BasicDeserializerFactory
Enum
types.
createEnumDeserializer
in class BasicDeserializerFactory
JsonMappingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |