public final class SerializationConfig extends MapperConfigBase<SerializationFeature,SerializationConfig> implements Serializable
ObjectMapper
, which
passes an immutable instance for serialization process to
SerializerProvider
and SerializerFactory
(either directly, or through ObjectWriter
.
Note that instances are considered immutable and as such no copies
should need to be created for sharing; all copying is done with
"fluent factory" methods.
Note also that unlike with Jackson 1, these instances can not be
assigned to ObjectMapper
; in fact, application code should
rarely interact directly with these instance (unlike core Jackson code)
Modifier and Type | Field and Description |
---|---|
protected FilterProvider |
_filterProvider
Object used for resolving filter ids to filter instances.
|
protected int |
_generatorFeatures
States of
JsonGenerator.Feature s to enable/disable. |
protected int |
_generatorFeaturesToChange
Bitflag of
JsonGenerator.Feature s to enable/disable |
protected int |
_serFeatures
Set of
SerializationFeature s enabled. |
protected com.fasterxml.jackson.annotation.JsonInclude.Include |
_serializationInclusion
Which Bean/Map properties are to be included in serialization?
Default settings is to include all regardless of value; can be
changed to only include non-null properties, or properties
with non-default values.
|
_attributes, _mixInAnnotations, _rootName, _subtypeResolver, _view
_base, _mapperFeatures
Modifier | Constructor and Description |
---|---|
|
SerializationConfig(BaseSettings base,
SubtypeResolver str,
Map<ClassKey,Class<?>> mixins)
Constructor used by ObjectMapper to create default configuration object instance.
|
protected |
SerializationConfig(SerializationConfig src,
ContextAttributes attrs) |
protected |
SerializationConfig(SerializationConfig src,
Map<ClassKey,Class<?>> mixins) |
Modifier and Type | Method and Description |
---|---|
AnnotationIntrospector |
getAnnotationIntrospector()
Method for getting
AnnotationIntrospector configured
to introspect annotation values used for 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).
|
FilterProvider |
getFilterProvider()
Method for getting provider used for locating filters given
id (which is usually provided with filter annotations).
|
int |
getSerializationFeatures() |
com.fasterxml.jackson.annotation.JsonInclude.Include |
getSerializationInclusion() |
boolean |
hasSerializationFeatures(int featureMask)
"Bulk" access method for checking that all features specified by
mask are enabled.
|
void |
initialize(com.fasterxml.jackson.core.JsonGenerator g)
Method called by
ObjectMapper and ObjectWriter
to modify those JsonGenerator.Feature settings
that have been configured via this config instance. |
<T extends BeanDescription> |
introspect(JavaType type)
Method that will introspect full bean properties for the purpose
of building a bean serializer
|
BeanDescription |
introspectClassAnnotations(JavaType type)
Accessor for getting bean description that only contains class
annotations: useful if no getter/setter/creator information is needed.
|
BeanDescription |
introspectDirectClassAnnotations(JavaType type)
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.
|
boolean |
isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f,
com.fasterxml.jackson.core.JsonFactory factory)
Accessor method that first checks if we have any overrides
for feature, and only if not, checks state of passed-in
factory.
|
boolean |
isEnabled(SerializationFeature f) |
String |
toString() |
boolean |
useRootWrapping()
Accessor for checking whether configuration indicates that
"root wrapping" (use of an extra property/name pair at root level)
is expected or not.
|
SerializationConfig |
with(AnnotationIntrospector ai)
Method for constructing and returning a new instance with different
AnnotationIntrospector to use (replacing old one). |
SerializationConfig |
with(com.fasterxml.jackson.core.Base64Variant base64)
Method for constructing and returning a new instance with different
default
Base64Variant to use with base64-encoded binary values. |
SerializationConfig |
with(ClassIntrospector ci)
Method for constructing and returning a new instance with different
ClassIntrospector
to use. |
SerializationConfig |
with(ContextAttributes attrs)
Method for constructing an instance that has specified
contextual attributes.
|
SerializationConfig |
with(DateFormat df)
In addition to constructing instance with specified date format,
will enable or disable
SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
(enable if format set as null; disable if non-null) |
SerializationConfig |
with(HandlerInstantiator hi)
Method for constructing and returning a new instance with different
HandlerInstantiator
to use. |
SerializationConfig |
with(com.fasterxml.jackson.core.JsonGenerator.Feature feature)
Fluent factory method that will construct and return a new configuration
object instance with specified feature enabled.
|
SerializationConfig |
with(Locale l)
Method for constructing and returning a new instance with different
default
Locale to use for formatting. |
SerializationConfig |
with(MapperFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features enabled.
|
SerializationConfig |
with(MapperFeature feature,
boolean state) |
SerializationConfig |
with(PropertyNamingStrategy pns)
Method for constructing and returning a new instance with different
PropertyNamingStrategy
to use. |
SerializationConfig |
with(SerializationFeature feature)
Fluent factory method that will construct and return a new configuration
object instance with specified feature enabled.
|
SerializationConfig |
with(SerializationFeature first,
SerializationFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features enabled.
|
SerializationConfig |
with(SubtypeResolver str)
Method for constructing and returning a new instance with different
SubtypeResolver
to use. |
SerializationConfig |
with(TimeZone tz)
Method for constructing and returning a new instance with different
default
TimeZone to use for formatting of date values. |
SerializationConfig |
with(TypeFactory tf)
Method for constructing and returning a new instance with different
TypeFactory
to use. |
SerializationConfig |
with(TypeResolverBuilder<?> trb)
Method for constructing and returning a new instance with different
TypeResolverBuilder to use. |
SerializationConfig |
with(VisibilityChecker<?> vc)
Method for constructing and returning a new instance with different
VisibilityChecker
to use. |
SerializationConfig |
withAppendedAnnotationIntrospector(AnnotationIntrospector ai)
Method for constructing and returning a new instance with additional
AnnotationIntrospector appended (as the lowest priority one) |
SerializationConfig |
withFeatures(com.fasterxml.jackson.core.JsonGenerator.Feature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features enabled.
|
SerializationConfig |
withFeatures(SerializationFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features enabled.
|
SerializationConfig |
withFilters(FilterProvider filterProvider) |
SerializationConfig |
withInsertedAnnotationIntrospector(AnnotationIntrospector ai)
Method for constructing and returning a new instance with additional
AnnotationIntrospector inserted (as the highest priority one) |
SerializationConfig |
without(com.fasterxml.jackson.core.JsonGenerator.Feature feature)
Fluent factory method that will construct and return a new configuration
object instance with specified feature disabled.
|
SerializationConfig |
without(MapperFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features disabled.
|
SerializationConfig |
without(SerializationFeature feature)
Fluent factory method that will construct and return a new configuration
object instance with specified feature disabled.
|
SerializationConfig |
without(SerializationFeature first,
SerializationFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features disabled.
|
SerializationConfig |
withoutFeatures(com.fasterxml.jackson.core.JsonGenerator.Feature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features disabled.
|
SerializationConfig |
withoutFeatures(SerializationFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features disabled.
|
SerializationConfig |
withRootName(String rootName)
Method for constructing and returning a new instance with different
root name to use (none, if null).
|
SerializationConfig |
withSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include incl) |
SerializationConfig |
withView(Class<?> view)
Method for constructing and returning a new instance with different
view to use.
|
SerializationConfig |
withVisibility(com.fasterxml.jackson.annotation.PropertyAccessor forMethod,
com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility visibility)
Method for constructing and returning a new instance with different
minimal visibility level for specified property type
|
findMixInClassFor, getActiveView, getAttributes, getRootName, getSubtypeResolver, mixInCount, withAttribute, withAttributes, withoutAttribute
canOverrideAccessModifiers, collectFeatureDefaults, compileString, constructSpecializedType, constructType, constructType, getBase64Variant, getClassIntrospector, getDateFormat, getDefaultTyper, getHandlerInstantiator, getLocale, getPropertyNamingStrategy, getTimeZone, getTypeFactory, hasMapperFeatures, introspectClassAnnotations, introspectDirectClassAnnotations, isAnnotationProcessingEnabled, isEnabled, shouldSortPropertiesAlphabetically, typeIdResolverInstance, typeResolverBuilderInstance
protected final int _serFeatures
SerializationFeature
s enabled.protected com.fasterxml.jackson.annotation.JsonInclude.Include _serializationInclusion
protected final FilterProvider _filterProvider
protected final int _generatorFeatures
JsonGenerator.Feature
s to enable/disable.protected final int _generatorFeaturesToChange
JsonGenerator.Feature
s to enable/disablepublic SerializationConfig(BaseSettings base, SubtypeResolver str, Map<ClassKey,Class<?>> mixins)
protected SerializationConfig(SerializationConfig src, Map<ClassKey,Class<?>> mixins)
protected SerializationConfig(SerializationConfig src, ContextAttributes attrs)
public SerializationConfig with(MapperFeature... features)
with
in class MapperConfig<SerializationConfig>
public SerializationConfig without(MapperFeature... features)
without
in class MapperConfig<SerializationConfig>
public SerializationConfig with(MapperFeature feature, boolean state)
with
in class MapperConfig<SerializationConfig>
public SerializationConfig with(AnnotationIntrospector ai)
MapperConfigBase
AnnotationIntrospector
to use (replacing old one).
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig withAppendedAnnotationIntrospector(AnnotationIntrospector ai)
MapperConfigBase
AnnotationIntrospector
appended (as the lowest priority one)withAppendedAnnotationIntrospector
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig withInsertedAnnotationIntrospector(AnnotationIntrospector ai)
MapperConfigBase
AnnotationIntrospector
inserted (as the highest priority one)withInsertedAnnotationIntrospector
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(ClassIntrospector ci)
MapperConfigBase
ClassIntrospector
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(DateFormat df)
SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
(enable if format set as null; disable if non-null)with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(HandlerInstantiator hi)
MapperConfigBase
HandlerInstantiator
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(PropertyNamingStrategy pns)
MapperConfigBase
PropertyNamingStrategy
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig withRootName(String rootName)
MapperConfigBase
Note that when a root name is set to a non-Empty String, this will automatically force use
of root element wrapping with given name. If empty String passed, will
disable root name wrapping; and if null used, will instead use
SerializationFeature
to determine if to use wrapping, and annotation
(or default name) for actual root name to use.
withRootName
in class MapperConfigBase<SerializationFeature,SerializationConfig>
rootName
- to use: if null, means "use default" (clear setting);
if empty String ("") means that no root name wrapping is used;
otherwise defines root name to use.public SerializationConfig with(SubtypeResolver str)
MapperConfigBase
SubtypeResolver
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(TypeFactory tf)
MapperConfigBase
TypeFactory
to use.with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(TypeResolverBuilder<?> trb)
MapperConfigBase
TypeResolverBuilder
to use.with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig withView(Class<?> view)
MapperConfigBase
withView
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(VisibilityChecker<?> vc)
MapperConfigBase
VisibilityChecker
to use.with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig withVisibility(com.fasterxml.jackson.annotation.PropertyAccessor forMethod, com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility visibility)
MapperConfigBase
withVisibility
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(Locale l)
MapperConfigBase
Locale
to use for formatting.with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(TimeZone tz)
MapperConfigBase
TimeZone
to use for formatting of date values.with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(com.fasterxml.jackson.core.Base64Variant base64)
MapperConfigBase
Base64Variant
to use with base64-encoded binary values.with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(ContextAttributes attrs)
MapperConfigBase
with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(SerializationFeature feature)
public SerializationConfig with(SerializationFeature first, SerializationFeature... features)
public SerializationConfig withFeatures(SerializationFeature... features)
public SerializationConfig without(SerializationFeature feature)
public SerializationConfig without(SerializationFeature first, SerializationFeature... features)
public SerializationConfig withoutFeatures(SerializationFeature... features)
public SerializationConfig with(com.fasterxml.jackson.core.JsonGenerator.Feature feature)
public SerializationConfig withFeatures(com.fasterxml.jackson.core.JsonGenerator.Feature... features)
public SerializationConfig without(com.fasterxml.jackson.core.JsonGenerator.Feature feature)
public SerializationConfig withoutFeatures(com.fasterxml.jackson.core.JsonGenerator.Feature... features)
public SerializationConfig withFilters(FilterProvider filterProvider)
public SerializationConfig withSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include incl)
public void initialize(com.fasterxml.jackson.core.JsonGenerator g)
ObjectMapper
and ObjectWriter
to modify those JsonGenerator.Feature
settings
that have been configured via this config instance.public boolean useRootWrapping()
MapperConfig
useRootWrapping
in class MapperConfig<SerializationConfig>
public AnnotationIntrospector getAnnotationIntrospector()
MapperConfig
AnnotationIntrospector
configured
to introspect annotation values used for configuration.
Non-final since it is actually overridden by sub-classes (for now?)
getAnnotationIntrospector
in class MapperConfig<SerializationConfig>
public BeanDescription introspectClassAnnotations(JavaType type)
introspectClassAnnotations
in class MapperConfig<SerializationConfig>
public BeanDescription introspectDirectClassAnnotations(JavaType type)
introspectDirectClassAnnotations
in class MapperConfig<SerializationConfig>
public VisibilityChecker<?> getDefaultVisibilityChecker()
MapperConfig
JsonAutoDetect
annotation)getDefaultVisibilityChecker
in class MapperConfig<SerializationConfig>
public final boolean isEnabled(SerializationFeature f)
public final boolean isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f, com.fasterxml.jackson.core.JsonFactory factory)
public final boolean hasSerializationFeatures(int featureMask)
public final int getSerializationFeatures()
public com.fasterxml.jackson.annotation.JsonInclude.Include getSerializationInclusion()
public FilterProvider getFilterProvider()
ObjectWriter
(or if serialization directly called from ObjectMapper
)public <T extends BeanDescription> T introspect(JavaType type)
Copyright © 2014-2015 FasterXML. All Rights Reserved.