|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.jackson.map.DeserializationConfig
public class DeserializationConfig
Object that contains baseline configuration for deserialization
process. An instance is owned by ObjectMapper, which makes
a copy that is passed during serialization process to
DeserializerProvider and DeserializerFactory.
Note: although configuration settings can be changed at any time (for factories and instances), they are not guaranteed to have effect if called after constructing relevant mapper or deserializer instance. This because some objects may be configured, constructed and cached first time they are needed.
| Nested Class Summary | |
|---|---|
static class |
DeserializationConfig.Feature
Enumeration that defines togglable features that guide the serialization feature. |
| Field Summary | |
|---|---|
protected AbstractTypeResolver |
_abstractTypeResolver
To support on-the-fly class generation for interface and abstract classes it is possible to register "abstract type resolver". |
protected AnnotationIntrospector |
_annotationIntrospector
Introspector used for accessing annotation value based configuration. |
protected ClassIntrospector<? extends BeanDescription> |
_classIntrospector
Introspector used to figure out Bean properties needed for bean serialization and deserialization. |
protected DateFormat |
_dateFormat
Custom date format to use for de-serialization. |
protected int |
_featureFlags
Bit set that contains all enabled features |
protected HashMap<ClassKey,Class<?>> |
_mixInAnnotations
Mapping that defines how to apply mix-in annotations: key is the type to received additional annotations, and value is the type that has annotations to "mix in". |
protected boolean |
_mixInAnnotationsShared
Flag used to detect when a copy if mix-in annotations is needed: set when current copy is shared, cleared when a fresh copy is made |
protected JsonNodeFactory |
_nodeFactory
Factory used for constructing JsonNode instances. |
protected LinkedNode<DeserializationProblemHandler> |
_problemHandlers
Linked list that contains all registered problem handlers. |
protected SubtypeResolver |
_subtypeResolver
Registered concrete subtypes that can be used instead of (or in addition to) ones declared using annotations. |
protected TypeResolverBuilder<?> |
_typer
Type information handler used for "untyped" values (ones declared to have type Object.class) |
protected VisibilityChecker<?> |
_visibilityChecker
Object used for determining whether specific property elements (method, constructors, fields) can be auto-detected based on their visibility (access modifiers). |
protected static DateFormat |
DEFAULT_DATE_FORMAT
|
protected static int |
DEFAULT_FEATURE_FLAGS
Bitfield (set of flags) of all Features that are enabled by default. |
| Constructor Summary | |
|---|---|
|
DeserializationConfig(ClassIntrospector<? extends BeanDescription> intr,
AnnotationIntrospector annIntr,
VisibilityChecker<?> vc,
SubtypeResolver subtypeResolver)
|
protected |
DeserializationConfig(DeserializationConfig src,
HashMap<ClassKey,Class<?>> mixins,
TypeResolverBuilder<?> typer,
VisibilityChecker<?> vc,
SubtypeResolver subtypeResolver)
|
| Method Summary | ||
|---|---|---|
void |
addHandler(DeserializationProblemHandler h)
Method that can be used to add a handler that can (try to) resolve non-fatal deserialization problems. |
|
void |
addMixInAnnotations(Class<?> target,
Class<?> mixinSource)
Method to use for adding mix-in annotations to use for augmenting specified class or interface. |
|
void |
appendAnnotationIntrospector(AnnotationIntrospector introspector)
Method for registering specified AnnotationIntrospector as the lowest
priority introspector, chained with existing introspector(s) and called
as fallback for cases not otherwise handled. |
|
void |
clearHandlers()
Method for removing all configuring problem handlers; usually done to replace existing handler(s) with different one(s) |
|
DeserializationConfig |
createUnshared(JsonNodeFactory nf)
Alternative "copy factory" that creates an unshared copy that uses different node factory than this instance. |
|
DeserializationConfig |
createUnshared(TypeResolverBuilder<?> typer,
VisibilityChecker<?> vc,
SubtypeResolver subtypeResolver)
Method that is called to create a non-shared copy of the configuration to be used for a deserialization operation. |
|
void |
disable(DeserializationConfig.Feature f)
Method for disabling specified feature. |
|
void |
enable(DeserializationConfig.Feature f)
Method for enabling specified feature. |
|
Class<?> |
findMixInClassFor(Class<?> cls)
Method that will check if there are "mix-in" classes (with mix-in annotations) for given class |
|
void |
fromAnnotations(Class<?> cls)
Method that checks class annotations that the argument Object has, and modifies settings of this configuration object accordingly, similar to how those annotations would affect actual value classes annotated with them, but with global scope. |
|
AbstractTypeResolver |
getAbstractTypeResolver()
Method for accessing AbstractTypeResolver configured, if any
(no default) used for resolving abstract types into concrete
types (either by mapping or materializing new classes). |
|
AnnotationIntrospector |
getAnnotationIntrospector()
Method for getting AnnotationIntrospector configured
to introspect annotation values used for configuration. |
|
Base64Variant |
getBase64Variant()
Method called during deserialization if Base64 encoded content needs to be decoded. |
|
DateFormat |
getDateFormat()
Method for accessing currently configured (textual) date format that will be used for reading or writing date values (in case of writing, only if textual output is configured; not if dates are to be serialized as time stamps). |
|
TypeResolverBuilder<?> |
getDefaultTyper(JavaType baseType)
Method called to locate a type info handler for types that do not have one explicitly declared via annotations (or other configuration). |
|
VisibilityChecker<?> |
getDefaultVisibilityChecker()
Accessor for object used for determining whether specific property elements (method, constructors, fields) can be auto-detected based on their visibility (access modifiers). |
|
JsonNodeFactory |
getNodeFactory()
|
|
LinkedNode<DeserializationProblemHandler> |
getProblemHandlers()
Method for getting head of the problem handler chain. |
|
SubtypeResolver |
getSubtypeResolver()
Accessor for object used for finding out all reachable subtypes for supertypes; needed when a logical type name is used instead of class name (or custom scheme). |
|
void |
insertAnnotationIntrospector(AnnotationIntrospector introspector)
Method for registering specified AnnotationIntrospector as the highest
priority introspector (will be chained with existing introspector(s) which
will be used as fallbacks for cases this introspector does not handle) |
|
|
introspect(JavaType type)
Method that will introspect full bean properties for the purpose of building a bean deserializer |
|
|
introspectClassAnnotations(Class<?> cls)
Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed. |
|
|
introspectDirectClassAnnotations(Class<?> cls)
Accessor for getting bean description that only contains immediate class annotations: ones from the class, and its direct mix-in, if any, but not from super types. |
|
|
introspectForCreation(JavaType type)
Method that will introspect subset of bean properties needed to construct bean instance. |
|
boolean |
isEnabled(DeserializationConfig.Feature f)
Method for checking whether given feature is enabled or not |
|
void |
set(DeserializationConfig.Feature f,
boolean state)
Method for enabling or disabling specified feature. |
|
void |
setAbstractTypeResolver(AbstractTypeResolver atr)
|
|
void |
setAnnotationIntrospector(AnnotationIntrospector introspector)
Method for replacing existing annotation introspector(s) with specified introspector. |
|
void |
setDateFormat(DateFormat df)
Method that will set the textual deserialization to use for deserializing Dates (and Calendars). |
|
void |
setIntrospector(ClassIntrospector<? extends BeanDescription> i)
Method for replacing existing ClassIntrospector with
specified replacement. |
|
void |
setMixInAnnotations(Map<Class<?>,Class<?>> sourceMixins)
Method to use for defining mix-in annotations to use for augmenting annotations that deserializable classes have. |
|
void |
setNodeFactory(JsonNodeFactory nf)
|
|
void |
setSubtypeResolver(SubtypeResolver r)
Method for overriding subtype resolver used. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int DEFAULT_FEATURE_FLAGS
protected static final DateFormat DEFAULT_DATE_FORMAT
protected ClassIntrospector<? extends BeanDescription> _classIntrospector
protected AnnotationIntrospector _annotationIntrospector
protected int _featureFlags
protected LinkedNode<DeserializationProblemHandler> _problemHandlers
protected DateFormat _dateFormat
StdDateFormat.
Note that the configured format object will be cloned once per deserialization process (first time it is needed)
protected HashMap<ClassKey,Class<?>> _mixInAnnotations
Annotations associated with the value classes will be used to override annotations of the key class, associated with the same field or method. They can be further masked by sub-classes: you can think of it as injecting annotations between the target class and its sub-classes (or interfaces)
protected boolean _mixInAnnotationsShared
protected final TypeResolverBuilder<?> _typer
Object.class)
protected VisibilityChecker<?> _visibilityChecker
JsonAutoDetect annotation)
protected SubtypeResolver _subtypeResolver
protected AbstractTypeResolver _abstractTypeResolver
protected JsonNodeFactory _nodeFactory
JsonNode instances.
| Constructor Detail |
|---|
public DeserializationConfig(ClassIntrospector<? extends BeanDescription> intr,
AnnotationIntrospector annIntr,
VisibilityChecker<?> vc,
SubtypeResolver subtypeResolver)
protected DeserializationConfig(DeserializationConfig src,
HashMap<ClassKey,Class<?>> mixins,
TypeResolverBuilder<?> typer,
VisibilityChecker<?> vc,
SubtypeResolver subtypeResolver)
| Method Detail |
|---|
public void enable(DeserializationConfig.Feature f)
public void disable(DeserializationConfig.Feature f)
public void set(DeserializationConfig.Feature f,
boolean state)
public final boolean isEnabled(DeserializationConfig.Feature f)
public void fromAnnotations(Class<?> cls)
Ones that are known to have effect are:
fromAnnotations in interface MapperConfig<DeserializationConfig>cls - Class of which class annotations to use
for changing configuration settings
public DeserializationConfig createUnshared(TypeResolverBuilder<?> typer,
VisibilityChecker<?> vc,
SubtypeResolver subtypeResolver)
createUnshared in interface MapperConfig<DeserializationConfig>public DeserializationConfig createUnshared(JsonNodeFactory nf)
public void setIntrospector(ClassIntrospector<? extends BeanDescription> i)
MapperConfigClassIntrospector with
specified replacement.
setIntrospector in interface MapperConfig<DeserializationConfig>public AnnotationIntrospector getAnnotationIntrospector()
AnnotationIntrospector configured
to introspect annotation values used for configuration.
getAnnotationIntrospector in interface MapperConfig<DeserializationConfig>public void setAnnotationIntrospector(AnnotationIntrospector introspector)
MapperConfig
setAnnotationIntrospector in interface MapperConfig<DeserializationConfig>public void insertAnnotationIntrospector(AnnotationIntrospector introspector)
MapperConfigAnnotationIntrospector as the highest
priority introspector (will be chained with existing introspector(s) which
will be used as fallbacks for cases this introspector does not handle)
insertAnnotationIntrospector in interface MapperConfig<DeserializationConfig>introspector - Annotation introspector to register.public void appendAnnotationIntrospector(AnnotationIntrospector introspector)
MapperConfigAnnotationIntrospector as the lowest
priority introspector, chained with existing introspector(s) and called
as fallback for cases not otherwise handled.
appendAnnotationIntrospector in interface MapperConfig<DeserializationConfig>introspector - Annotation introspector to register.public void setMixInAnnotations(Map<Class<?>,Class<?>> sourceMixins)
Note: a copy of argument Map is created; the original Map is not modified or retained by this config object.
setMixInAnnotations in interface MapperConfig<DeserializationConfig>
public void addMixInAnnotations(Class<?> target,
Class<?> mixinSource)
MapperConfigmixinSource are taken to override annotations
that target (or its supertypes) has.
addMixInAnnotations in interface MapperConfig<DeserializationConfig>target - Class (or interface) whose annotations to effectively overridemixinSource - Class (or interface) whose annotations are to
be "added" to target's annotations, overriding as necessarypublic Class<?> findMixInClassFor(Class<?> cls)
MapperConfig
findMixInClassFor in interface ClassIntrospector.MixInResolverfindMixInClassFor in interface MapperConfig<DeserializationConfig>public DateFormat getDateFormat()
MapperConfig
Note that typically DateFormat instances are not thread-safe
(at least ones provided by JDK):
this means that calling code should clone format instance before
using it.
This method is usually only called by framework itself, since there
are convenience methods available via
DeserializationContext and SerializerProvider that
take care of cloning and thread-safe reuse.
getDateFormat in interface MapperConfig<DeserializationConfig>public void setDateFormat(DateFormat df)
StdDateFormat.
setDateFormat in interface MapperConfig<DeserializationConfig>public VisibilityChecker<?> getDefaultVisibilityChecker()
MapperConfigJsonAutoDetect annotation)
getDefaultVisibilityChecker in interface MapperConfig<DeserializationConfig>public TypeResolverBuilder<?> getDefaultTyper(JavaType baseType)
MapperConfig
getDefaultTyper in interface MapperConfig<DeserializationConfig>public SubtypeResolver getSubtypeResolver()
MapperConfig
getSubtypeResolver in interface MapperConfig<DeserializationConfig>public void setSubtypeResolver(SubtypeResolver r)
MapperConfig
setSubtypeResolver in interface MapperConfig<DeserializationConfig>public <T extends BeanDescription> T introspectClassAnnotations(Class<?> cls)
Note: part of MapperConfig since 1.7
introspectClassAnnotations in interface MapperConfig<DeserializationConfig>public <T extends BeanDescription> T introspectDirectClassAnnotations(Class<?> cls)
Note: part of MapperConfig since 1.7
introspectDirectClassAnnotations in interface MapperConfig<DeserializationConfig>public LinkedNode<DeserializationProblemHandler> getProblemHandlers()
public void addHandler(DeserializationProblemHandler h)
public void clearHandlers()
public <T extends BeanDescription> T introspect(JavaType type)
type - Type of class to be introspectedpublic <T extends BeanDescription> T introspectForCreation(JavaType type)
public AbstractTypeResolver getAbstractTypeResolver()
AbstractTypeResolver configured, if any
(no default) used for resolving abstract types into concrete
types (either by mapping or materializing new classes).
public void setAbstractTypeResolver(AbstractTypeResolver atr)
public Base64Variant getBase64Variant()
public void setNodeFactory(JsonNodeFactory nf)
public final JsonNodeFactory getNodeFactory()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||