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.
Modifier and Type | Field and Description |
---|---|
protected ConstructorDetector |
_ctorDetector |
protected com.fasterxml.jackson.core.PrettyPrinter |
_defaultPrettyPrinter
If "default pretty-printing" is enabled, it will create the instance
from this blueprint object.
|
protected FilterProvider |
_filterProvider
Object used for resolving filter ids to filter instances.
|
protected int |
_formatWriteFeatures
States of
FormatFeature s to enable/disable. |
protected int |
_formatWriteFeaturesToChange
Bitflag of
FormatFeature s to enable/disable |
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 static com.fasterxml.jackson.core.PrettyPrinter |
DEFAULT_PRETTY_PRINTER |
_attributes, _configOverrides, _datatypeFeatures, _mixIns, _rootName, _rootNames, _subtypeResolver, _view, EMPTY_OVERRIDE
_base, _mapperFeatures, EMPTY_FORMAT, EMPTY_INCLUDE
Modifier | Constructor and Description |
---|---|
|
SerializationConfig(BaseSettings base,
SubtypeResolver str,
SimpleMixInResolver mixins,
RootNameLookup rootNames,
ConfigOverrides configOverrides)
Deprecated.
since 2.14
|
|
SerializationConfig(BaseSettings base,
SubtypeResolver str,
SimpleMixInResolver mixins,
RootNameLookup rootNames,
ConfigOverrides configOverrides,
DatatypeFeatures datatypeFeatures)
Constructor used by ObjectMapper to create default configuration object instance.
|
protected |
SerializationConfig(SerializationConfig src,
ConstructorDetector ctorDetector) |
protected |
SerializationConfig(SerializationConfig src,
ContextAttributes attrs) |
protected |
SerializationConfig(SerializationConfig src,
DatatypeFeatures dtFeatures) |
protected |
SerializationConfig(SerializationConfig src,
com.fasterxml.jackson.core.PrettyPrinter defaultPP) |
protected |
SerializationConfig(SerializationConfig src,
SimpleMixInResolver mixins) |
protected |
SerializationConfig(SerializationConfig src,
SubtypeResolver str,
SimpleMixInResolver mixins,
RootNameLookup rootNames,
ConfigOverrides configOverrides)
Copy-constructor used for making a copy to be used by new
ObjectMapper . |
Modifier and Type | Method and Description |
---|---|
protected SerializationConfig |
_with(DatatypeFeatures dtFeatures) |
protected SerializationConfig |
_withBase(BaseSettings newBase) |
protected SerializationConfig |
_withMapperFeatures(long mapperFeatures) |
com.fasterxml.jackson.core.PrettyPrinter |
constructDefaultPrettyPrinter() |
ConstructorDetector |
getConstructorDetector() |
com.fasterxml.jackson.core.PrettyPrinter |
getDefaultPrettyPrinter()
Accessor for configured blueprint "default"
PrettyPrinter to
use, if default pretty-printing is enabled. |
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()
Deprecated.
Since 2.7 use
MapperConfigBase.getDefaultPropertyInclusion() instead |
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. |
BeanDescription |
introspect(JavaType type)
Method that will introspect full bean properties for the purpose
of building a bean serializer
|
boolean |
isEnabled(DatatypeFeature feature)
Accessor for checking whether give
DatatypeFeature
is enabled or not. |
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 feature)
Accessor for checking whether give
SerializationFeature
is enabled or not. |
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(ConstructorDetector ctorDetector) |
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(com.fasterxml.jackson.core.FormatFeature feature)
Fluent factory method that will construct and return a new configuration
object instance with specified feature enabled.
|
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(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 |
withDefaultPrettyPrinter(com.fasterxml.jackson.core.PrettyPrinter pp) |
SerializationConfig |
withFeatures(com.fasterxml.jackson.core.FormatFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features enabled.
|
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 |
without(com.fasterxml.jackson.core.FormatFeature feature)
Fluent factory method that will construct and return a new configuration
object instance with specified feature disabled.
|
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(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.FormatFeature... 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 |
withPropertyInclusion(com.fasterxml.jackson.annotation.JsonInclude.Value incl)
Deprecated.
Since 2.9; not needed any more
|
SerializationConfig |
withRootName(PropertyName rootName)
Method for constructing and returning a new instance with different
root name to use (none, if null).
|
SerializationConfig |
withView(Class<?> view)
Method for constructing and returning a new instance with different
view to use.
|
_datatypeFeatures, copy, findConfigOverride, findMixInClassFor, findRootName, findRootName, getActiveView, getAttributes, getConfigOverride, getDatatypeFeatures, getDefaultInclusion, getDefaultMergeable, getDefaultMergeable, getDefaultPropertyFormat, getDefaultPropertyIgnorals, getDefaultPropertyIgnorals, getDefaultPropertyInclusion, getDefaultPropertyInclusion, getDefaultPropertyInclusions, getDefaultSetterInfo, getDefaultVisibilityChecker, getDefaultVisibilityChecker, getFullRootName, getRootName, getSubtypeResolver, mixInCount, with, with, with, with, with, with, with, with, with, with, with, with, with, with, with, withAppendedAnnotationIntrospector, withAttribute, withAttributes, withFeatures, withInsertedAnnotationIntrospector, without, without, withoutAttribute, withoutFeatures, withRootName
canOverrideAccessModifiers, collectFeatureDefaults, compileString, constructSpecializedType, constructType, constructType, getAccessorNaming, getAnnotationIntrospector, getBase64Variant, getCacheProvider, getClassIntrospector, getDateFormat, getDefaultInclusion, getDefaultPropertyInclusion, getDefaultTyper, getHandlerInstantiator, getLocale, getPolymorphicTypeValidator, getPropertyNamingStrategy, getTimeZone, getTypeFactory, hasExplicitTimeZone, hasMapperFeatures, introspectClassAnnotations, introspectClassAnnotations, introspectDirectClassAnnotations, introspectDirectClassAnnotations, isAnnotationProcessingEnabled, isEnabled, shouldSortPropertiesAlphabetically, typeIdResolverInstance, typeResolverBuilderInstance
protected static final com.fasterxml.jackson.core.PrettyPrinter DEFAULT_PRETTY_PRINTER
protected final FilterProvider _filterProvider
protected final com.fasterxml.jackson.core.PrettyPrinter _defaultPrettyPrinter
protected final ConstructorDetector _ctorDetector
protected final int _serFeatures
SerializationFeature
s enabled.protected final int _generatorFeatures
JsonGenerator.Feature
s to enable/disable.protected final int _generatorFeaturesToChange
JsonGenerator.Feature
s to enable/disableprotected final int _formatWriteFeatures
FormatFeature
s to enable/disable.protected final int _formatWriteFeaturesToChange
FormatFeature
s to enable/disablepublic SerializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides, DatatypeFeatures datatypeFeatures)
@Deprecated public SerializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)
protected SerializationConfig(SerializationConfig src, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)
ObjectMapper
.protected SerializationConfig(SerializationConfig src, ContextAttributes attrs)
protected SerializationConfig(SerializationConfig src, SimpleMixInResolver mixins)
protected SerializationConfig(SerializationConfig src, com.fasterxml.jackson.core.PrettyPrinter defaultPP)
protected SerializationConfig(SerializationConfig src, DatatypeFeatures dtFeatures)
protected SerializationConfig(SerializationConfig src, ConstructorDetector ctorDetector)
protected final SerializationConfig _withBase(BaseSettings newBase)
_withBase
in class MapperConfigBase<SerializationFeature,SerializationConfig>
protected final SerializationConfig _withMapperFeatures(long mapperFeatures)
_withMapperFeatures
in class MapperConfigBase<SerializationFeature,SerializationConfig>
protected final SerializationConfig _with(DatatypeFeatures dtFeatures)
_with
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig withRootName(PropertyName 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 withView(Class<?> view)
MapperConfigBase
withView
in class MapperConfigBase<SerializationFeature,SerializationConfig>
public SerializationConfig with(ContextAttributes attrs)
MapperConfigBase
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(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 with(com.fasterxml.jackson.core.FormatFeature feature)
public SerializationConfig withFeatures(com.fasterxml.jackson.core.FormatFeature... features)
public SerializationConfig without(com.fasterxml.jackson.core.FormatFeature feature)
public SerializationConfig withoutFeatures(com.fasterxml.jackson.core.FormatFeature... features)
public SerializationConfig withFilters(FilterProvider filterProvider)
@Deprecated public SerializationConfig withPropertyInclusion(com.fasterxml.jackson.annotation.JsonInclude.Value incl)
public SerializationConfig withDefaultPrettyPrinter(com.fasterxml.jackson.core.PrettyPrinter pp)
public SerializationConfig with(ConstructorDetector ctorDetector)
public com.fasterxml.jackson.core.PrettyPrinter constructDefaultPrettyPrinter()
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.@Deprecated public com.fasterxml.jackson.annotation.JsonInclude.Include getSerializationInclusion()
MapperConfigBase.getDefaultPropertyInclusion()
insteadpublic boolean useRootWrapping()
MapperConfig
useRootWrapping
in class MapperConfig<SerializationConfig>
public final boolean isEnabled(SerializationFeature feature)
SerializationFeature
is enabled or not.feature
- Feature to checkpublic 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 final boolean isEnabled(DatatypeFeature feature)
DatatypeFeature
is enabled or not.isEnabled
in class MapperConfig<SerializationConfig>
feature
- Feature to checkpublic FilterProvider getFilterProvider()
ObjectWriter
(or if serialization directly called from ObjectMapper
)public com.fasterxml.jackson.core.PrettyPrinter getDefaultPrettyPrinter()
PrettyPrinter
to
use, if default pretty-printing is enabled.
NOTE: returns the "blueprint" instance, and does NOT construct
an instance ready to use; call constructDefaultPrettyPrinter()
if
actually usable instance is desired.
public ConstructorDetector getConstructorDetector()
getConstructorDetector
in class MapperConfig<SerializationConfig>
public BeanDescription introspect(JavaType type)
Copyright © 2008–2024 FasterXML. All rights reserved.