|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.MapperConfig<T>
public abstract class MapperConfig<T extends MapperConfig<T>>
Interface that defines functionality accessible through both serialization and deserialization configuration objects; accessors to mode-independent configuration settings and such.
Nested Class Summary | |
---|---|
static class |
MapperConfig.Base
Immutable container class used to store simple configuration settings. |
Field Summary | |
---|---|
protected MapperConfig.Base |
_base
Immutable container object for simple configuration settings. |
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 SubtypeResolver |
_subtypeResolver
Registered concrete subtypes that can be used instead of (or in addition to) ones declared using annotations. |
protected static DateFormat |
DEFAULT_DATE_FORMAT
This is the default DateFormat used unless overridden by
custom implementation. |
Constructor Summary | |
---|---|
protected |
MapperConfig(ClassIntrospector<? extends BeanDescription> ci,
AnnotationIntrospector ai,
VisibilityChecker<?> vc,
SubtypeResolver str,
PropertyNamingStrategy pns,
TypeFactory tf,
HandlerInstantiator hi)
|
protected |
MapperConfig(MapperConfig<?> src)
Simple copy constructor |
protected |
MapperConfig(MapperConfig<?> src,
MapperConfig.Base base,
SubtypeResolver str)
|
Method Summary | ||
---|---|---|
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. |
|
abstract boolean |
canOverrideAccessModifiers()
Accessor for determining whether it is ok to try to force override of access modifiers to be able to get or set values of non-public Methods, Fields; to invoke non-public Constructors, Methods; or to instantiate non-public Classes. |
|
JavaType |
constructType(Class<?> cls)
Helper method that will construct JavaType for given
raw class. |
|
abstract T |
createUnshared(SubtypeResolver subtypeResolver)
Method to use for constructing an instance that is not shared between multiple operations but only used for a single one (which may be this instance, if it is immutable; if not, a copy is constructed with same settings) |
|
abstract T |
createUnshared(TypeResolverBuilder<?> typer,
VisibilityChecker<?> vc,
SubtypeResolver subtypeResolver)
Deprecated. Since 1.8, use variant that does not take arguments |
|
Class<?> |
findMixInClassFor(Class<?> cls)
Method that will check if there are "mix-in" classes (with mix-in annotations) for given class |
|
abstract 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. |
|
AnnotationIntrospector |
getAnnotationIntrospector()
Method for getting AnnotationIntrospector configured
to introspect annotation values used for configuration. |
|
ClassIntrospector<? extends BeanDescription> |
getClassIntrospector()
|
|
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). |
|
HandlerInstantiator |
getHandlerInstantiator()
|
|
PropertyNamingStrategy |
getPropertyNamingStrategy()
|
|
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). |
|
TypeFactory |
getTypeFactory()
|
|
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) |
|
abstract
|
introspectClassAnnotations(Class<?> cls)
Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed. |
|
abstract
|
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. |
|
abstract boolean |
isAnnotationProcessingEnabled()
Method for determining whether annotation processing is enabled or not (default settings are typically that it is enabled; must explicitly disable). |
|
int |
mixInCount()
|
|
void |
setAnnotationIntrospector(AnnotationIntrospector ai)
Deprecated. Since 1.8, use either withAnnotationIntrospector(AnnotationIntrospector) or
Module API instead |
|
void |
setDateFormat(DateFormat df)
Deprecated. As of version 1.8, it is preferable to call method in ObjectMapper instead; or construct new instance with
withDateFormat(DateFormat) |
|
void |
setIntrospector(ClassIntrospector<? extends BeanDescription> ci)
Deprecated. Since 1.8, use withClassIntrospector(ClassIntrospector) instead |
|
void |
setMixInAnnotations(Map<Class<?>,Class<?>> sourceMixins)
Method to use for defining mix-in annotations to use for augmenting annotations that processable (serializable / deserializable) classes have. |
|
void |
setSubtypeResolver(SubtypeResolver str)
Deprecated. since 1.8, use withSubtypeResolver(SubtypeResolver) instead. |
|
TypeIdResolver |
typeIdResolverInstance(Annotated annotated,
Class<? extends TypeIdResolver> resolverClass)
Method that can be called to obtain an instance of TypeIdResolver of
specified type. |
|
TypeResolverBuilder<?> |
typeResolverBuilderInstance(Annotated annotated,
Class<? extends TypeResolverBuilder<?>> builderClass)
Method that can be called to obtain an instance of TypeIdResolver of
specified type. |
|
abstract T |
withAnnotationIntrospector(AnnotationIntrospector ai)
Method for constructing and returning a new instance with different AnnotationIntrospector
to use (replacing old one). |
|
abstract T |
withClassIntrospector(ClassIntrospector<? extends BeanDescription> ci)
Method for constructing and returning a new instance with different ClassIntrospector
to use. |
|
abstract T |
withDateFormat(DateFormat df)
Method for constructing and returning a new instance with different DateFormat
to use. |
|
abstract T |
withHandlerInstantiator(HandlerInstantiator hi)
Method for constructing and returning a new instance with different HandlerInstantiator
to use. |
|
abstract T |
withPropertyNamingStrategy(PropertyNamingStrategy strategy)
Method for constructing and returning a new instance with different PropertyNamingStrategy
to use. |
|
abstract T |
withSubtypeResolver(SubtypeResolver str)
Method for constructing and returning a new instance with different SubtypeResolver
to use. |
|
abstract T |
withTypeFactory(TypeFactory typeFactory)
Method for constructing and returning a new instance with different TypeFactory
to use. |
|
abstract T |
withTypeResolverBuilder(TypeResolverBuilder<?> trb)
Method for constructing and returning a new instance with different TypeResolverBuilder
to use. |
|
abstract T |
withVisibilityChecker(VisibilityChecker<?> vc)
Method for constructing and returning a new instance with different VisibilityChecker
to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final DateFormat DEFAULT_DATE_FORMAT
DateFormat
used unless overridden by
custom implementation.
protected MapperConfig.Base _base
Note: ideally this would be final, but until we can eliminate mutators, must keep it mutable.
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 SubtypeResolver _subtypeResolver
ObjectMapper
(or -Reader
or -Writer)
Note: this is the only property left as non-final, to allow lazy construction of the instance as necessary.
Constructor Detail |
---|
protected MapperConfig(ClassIntrospector<? extends BeanDescription> ci, AnnotationIntrospector ai, VisibilityChecker<?> vc, SubtypeResolver str, PropertyNamingStrategy pns, TypeFactory tf, HandlerInstantiator hi)
protected MapperConfig(MapperConfig<?> src)
protected MapperConfig(MapperConfig<?> src, MapperConfig.Base base, SubtypeResolver str)
Method Detail |
---|
public abstract void fromAnnotations(Class<?> cls)
public abstract T createUnshared(SubtypeResolver subtypeResolver)
public abstract T withClassIntrospector(ClassIntrospector<? extends BeanDescription> ci)
ClassIntrospector
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withAnnotationIntrospector(AnnotationIntrospector ai)
AnnotationIntrospector
to use (replacing old one).
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withVisibilityChecker(VisibilityChecker<?> vc)
VisibilityChecker
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withTypeResolverBuilder(TypeResolverBuilder<?> trb)
TypeResolverBuilder
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withSubtypeResolver(SubtypeResolver str)
SubtypeResolver
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withPropertyNamingStrategy(PropertyNamingStrategy strategy)
PropertyNamingStrategy
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withTypeFactory(TypeFactory typeFactory)
TypeFactory
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withDateFormat(DateFormat df)
DateFormat
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withHandlerInstantiator(HandlerInstantiator hi)
HandlerInstantiator
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public ClassIntrospector<? extends BeanDescription> getClassIntrospector()
public AnnotationIntrospector getAnnotationIntrospector()
AnnotationIntrospector
configured
to introspect annotation values used for configuration.
Non-final since it is actually overridden by sub-classes (for now?)
public final void insertAnnotationIntrospector(AnnotationIntrospector introspector)
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)
introspector
- Annotation introspector to register.public final void appendAnnotationIntrospector(AnnotationIntrospector introspector)
AnnotationIntrospector
as the lowest
priority introspector, chained with existing introspector(s) and called
as fallback for cases not otherwise handled.
introspector
- Annotation introspector to register.public final VisibilityChecker<?> getDefaultVisibilityChecker()
JsonAutoDetect
annotation)
public final PropertyNamingStrategy getPropertyNamingStrategy()
public final HandlerInstantiator getHandlerInstantiator()
public final void setMixInAnnotations(Map<Class<?>,Class<?>> sourceMixins)
public final void addMixInAnnotations(Class<?> target, Class<?> mixinSource)
mixinSource
are taken to override annotations
that target
(or its supertypes) has.
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 final Class<?> findMixInClassFor(Class<?> cls)
findMixInClassFor
in interface ClassIntrospector.MixInResolver
public final int mixInCount()
public final TypeResolverBuilder<?> getDefaultTyper(JavaType baseType)
public final SubtypeResolver getSubtypeResolver()
public final TypeFactory getTypeFactory()
public final JavaType constructType(Class<?> cls)
JavaType
for given
raw class.
This is a simple short-cut for:
getTypeFactory().constructType(cls);
public final DateFormat getDateFormat()
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.
public abstract <DESC extends BeanDescription> DESC introspectClassAnnotations(Class<?> cls)
public abstract <DESC extends BeanDescription> DESC introspectDirectClassAnnotations(Class<?> cls)
public abstract boolean isAnnotationProcessingEnabled()
public abstract boolean canOverrideAccessModifiers()
public TypeResolverBuilder<?> typeResolverBuilderInstance(Annotated annotated, Class<? extends TypeResolverBuilder<?>> builderClass)
TypeIdResolver
of
specified type.
public TypeIdResolver typeIdResolverInstance(Annotated annotated, Class<? extends TypeIdResolver> resolverClass)
TypeIdResolver
of
specified type.
@Deprecated public abstract T createUnshared(TypeResolverBuilder<?> typer, VisibilityChecker<?> vc, SubtypeResolver subtypeResolver)
@Deprecated public final void setIntrospector(ClassIntrospector<? extends BeanDescription> ci)
withClassIntrospector(ClassIntrospector)
instead
ClassIntrospector
with
specified replacement.
@Deprecated public final void setAnnotationIntrospector(AnnotationIntrospector ai)
withAnnotationIntrospector(AnnotationIntrospector)
or
Module API instead
@Deprecated public void setDateFormat(DateFormat df)
ObjectMapper
instead; or construct new instance with
withDateFormat(DateFormat)
StdDateFormat
.
Instance is used as is, without creating a clone.
Format object in use can be accessed using getDateFormat()
.
@Deprecated public final void setSubtypeResolver(SubtypeResolver str)
withSubtypeResolver(SubtypeResolver)
instead.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |