Top Description Fields Constructors Methods
com.fasterxml.jackson.databind

public final Class SerializationConfig

extends MapperConfigBase<SerializationFeature, SerializationConfig>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.text.DateFormat, com.fasterxml.jackson.annotation.*, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.json.JsonWriteFeature, com.fasterxml.jackson.core.util.DefaultPrettyPrinter, .Instantiatable, com.fasterxml.jackson.databind.cfg.*, com.fasterxml.jackson.databind.introspect.SimpleMixInResolver, com.fasterxml.jackson.databind.jsontype.SubtypeResolver, com.fasterxml.jackson.databind.ser.FilterProvider, .SerializerFactory, com.fasterxml.jackson.databind.util.RootNameLookup

Object that contains baseline configuration for serialization process. An instance is owned by 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.

Field Summary

Modifier and TypeField and Description
protected final ConstructorDetector
protected final PrettyPrinter
_defaultPrettyPrinter

If "default pretty-printing" is enabled, it will create the instance from this blueprint object.

protected final FilterProvider
_filterProvider

Object used for resolving filter ids to filter instances.

protected final int
protected final int
protected final int
protected final int
protected final int
protected static final PrettyPrinter
private static final int
private static final long
Inherited from com.fasterxml.jackson.databind.cfg.MapperConfigBase:
_attributes_configOverrides_datatypeFeatures_mixIns_rootName_rootNames_subtypeResolver_viewEMPTY_OVERRIDE

Constructor Summary

AccessConstructor and Description
public
SerializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides, DatatypeFeatures datatypeFeatures)

Constructor used by ObjectMapper to create default configuration object instance.

public
SerializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)
Deprecated since 2.14

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.

private
private
SerializationConfig(SerializationConfig src, long mapperFeatures, int serFeatures, int generatorFeatures, int generatorFeatureMask, int formatFeatures, int formatFeaturesMask)

private
private
private
private
protected
protected
protected
protected
protected

Method Summary

Modifier and TypeMethod and Description
protected final SerializationConfig
protected final SerializationConfig
private SerializationConfig
protected final SerializationConfig
private SerializationConfig
public PrettyPrinter
public ConstructorDetector
public PrettyPrinter
getDefaultPrettyPrinter()

Accessor for configured blueprint "default" PrettyPrinter to use, if default pretty-printing is enabled.

public FilterProvider
getFilterProvider()

Method for getting provider used for locating filters given id (which is usually provided with filter annotations).

public final int
public JsonInclude.Include
getSerializationInclusion()
Deprecated Since 2.7 use getDefaultPropertyInclusion instead

public final boolean
hasSerializationFeatures(int featureMask)

"Bulk" access method for checking that all features specified by mask are enabled.

public void
initialize(JsonGenerator g)

Method called by ObjectMapper and ObjectWriter to modify those com.fasterxml.jackson.core.JsonGenerator.Feature settings that have been configured via this config instance.

public BeanDescription
introspect(JavaType type)

Method that will introspect full bean properties for the purpose of building a bean serializer

public final boolean

Returns:

True if feature is enabled; false otherwise
isEnabled
(SerializationFeature
Feature to check
feature
)

Accessor for checking whether give SerializationFeature is enabled or not.

public final boolean
isEnabled(JsonGenerator.Feature f, JsonFactory factory)

Accessor method that first checks if we have any overrides for feature, and only if not, checks state of passed-in factory.

public final boolean

Returns:

True if feature is enabled; false otherwise
isEnabled
(DatatypeFeature
Feature to check
feature
)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfig.isEnabled.

Accessor for checking whether give DatatypeFeature is enabled or not.

public boolean
useRootWrapping()

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfig.useRootWrapping.

Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.

public SerializationConfig
with(SubtypeResolver str)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase.with.

Method for constructing and returning a new instance with different SubtypeResolver to use.

public SerializationConfig
with(ContextAttributes attrs)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase.with.

Method for constructing an instance that has specified contextual attributes.

public SerializationConfig
with(DateFormat df)

Overrides com.fasterxml.jackson.databind.cfg.MapperConfigBase.with.

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)

public SerializationConfig
with(SerializationFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

public SerializationConfig
with(SerializationFeature first, SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

public SerializationConfig
with(JsonGenerator.Feature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

public SerializationConfig
with(FormatFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

public SerializationConfig
with(ConstructorDetector ctorDetector)

public SerializationConfig
public SerializationConfig
withFeatures(SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

public SerializationConfig
withFeatures(JsonGenerator.Feature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

public SerializationConfig
withFeatures(FormatFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

public SerializationConfig
withFilters(FilterProvider filterProvider)

public SerializationConfig
without(SerializationFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

public SerializationConfig
without(SerializationFeature first, SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

public SerializationConfig
without(JsonGenerator.Feature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

public SerializationConfig
without(FormatFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

public SerializationConfig
withoutFeatures(SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

public SerializationConfig
withoutFeatures(JsonGenerator.Feature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

public SerializationConfig
withoutFeatures(FormatFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

public SerializationConfig
withPropertyInclusion(JsonInclude.Value incl)
Deprecated Since 2.9; not needed any more

Mutant factory method for constructing a new instance with different default inclusion criteria configuration.

public SerializationConfig
withRootName(PropertyName
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.
rootName
)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase.withRootName.

Method for constructing and returning a new instance with different root name to use (none, if null).

public SerializationConfig
withView(Class<?> view)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase.withView.

Method for constructing and returning a new instance with different view to use.

Inherited from com.fasterxml.jackson.databind.cfg.MapperConfigBase:
_datatypeFeaturescopyfindConfigOverridefindMixInClassForfindRootNamefindRootNamegetActiveViewgetAttributesgetConfigOverridegetDatatypeFeaturesgetDefaultInclusiongetDefaultMergeablegetDefaultMergeablegetDefaultPropertyFormatgetDefaultPropertyIgnoralsgetDefaultPropertyIgnoralsgetDefaultPropertyInclusiongetDefaultPropertyInclusiongetDefaultPropertyInclusionsgetDefaultSetterInfogetDefaultVisibilityCheckergetDefaultVisibilityCheckergetFullRootNamegetRootNamegetSubtypeResolvermixInCountwithwithwithwithwithwithwithwithwithwithwithwithwithwithwithwithAppendedAnnotationIntrospectorwithAttributewithAttributeswithFeatureswithInsertedAnnotationIntrospectorwithoutwithoutwithoutAttributewithoutFeatureswithRootName

Field Detail

_ctorDetectorback to summary
protected final ConstructorDetector _ctorDetector
Since
2.18 (only in DeserializationConfig from 2.12)
_defaultPrettyPrinterback to summary
protected final PrettyPrinter _defaultPrettyPrinter

If "default pretty-printing" is enabled, it will create the instance from this blueprint object.

Since
2.6
_filterProviderback to summary
protected final FilterProvider _filterProvider

Object used for resolving filter ids to filter instances. Non-null if explicitly defined; null by default.

_formatWriteFeaturesback to summary
protected final int _formatWriteFeatures

States of com.fasterxml.jackson.core.FormatFeatures to enable/disable.

Since
2.7
_formatWriteFeaturesToChangeback to summary
protected final int _formatWriteFeaturesToChange

Bitflag of com.fasterxml.jackson.core.FormatFeatures to enable/disable

Since
2.7
_generatorFeaturesback to summary
protected final int _generatorFeatures

States of com.fasterxml.jackson.core.JsonGenerator.Features to enable/disable.

_generatorFeaturesToChangeback to summary
protected final int _generatorFeaturesToChange

Bitflag of com.fasterxml.jackson.core.JsonGenerator.Features to enable/disable

_serFeaturesback to summary
protected final int _serFeatures

Set of SerializationFeatures enabled.

DEFAULT_PRETTY_PRINTERback to summary
protected static final PrettyPrinter DEFAULT_PRETTY_PRINTER
SER_FEATURE_DEFAULTSback to summary
private static final int SER_FEATURE_DEFAULTS
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.cfg.MapperConfig.serialVersionUID.

Constructor Detail

SerializationConfigback to summary
public SerializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides, DatatypeFeatures datatypeFeatures)

Constructor used by ObjectMapper to create default configuration object instance.

Since
2.14
SerializationConfigback to summary
public SerializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)

Deprecated

since 2.14

Annotations
@Deprecated
SerializationConfigback to summary
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.

Since
2.14
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, SubtypeResolver str)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, long mapperFeatures, int serFeatures, int generatorFeatures, int generatorFeatureMask, int formatFeatures, int formatFeaturesMask)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, BaseSettings base)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, FilterProvider filters)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, Class<?> view)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, PropertyName rootName)
SerializationConfigback to summary
protected SerializationConfig(SerializationConfig src, ContextAttributes attrs)
Since
2.1
SerializationConfigback to summary
protected SerializationConfig(SerializationConfig src, SimpleMixInResolver mixins)
Since
2.1
SerializationConfigback to summary
protected SerializationConfig(SerializationConfig src, PrettyPrinter defaultPP)
Since
2.6
SerializationConfigback to summary
protected SerializationConfig(SerializationConfig src, DatatypeFeatures dtFeatures)
Since
2.14
SerializationConfigback to summary
protected SerializationConfig(SerializationConfig src, ConstructorDetector ctorDetector)
Since
2.18

Method Detail

_withback to summary
protected final SerializationConfig _with(DatatypeFeatures dtFeatures)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase._with.

Annotations
@Override
_withBaseback to summary
protected final SerializationConfig _withBase(BaseSettings newBase)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase._withBase.

Annotations
@Override
_withJsonWriteFeaturesback to summary
private SerializationConfig _withJsonWriteFeatures(FormatFeature... features)
_withMapperFeaturesback to summary
protected final SerializationConfig _withMapperFeatures(long mapperFeatures)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase._withMapperFeatures.

Annotations
@Override
_withoutJsonWriteFeaturesback to summary
private SerializationConfig _withoutJsonWriteFeatures(FormatFeature... features)
constructDefaultPrettyPrinterback to summary
public PrettyPrinter constructDefaultPrettyPrinter()
getConstructorDetectorback to summary
public ConstructorDetector getConstructorDetector()

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfig.getConstructorDetector.

Annotations
@Override
getDefaultPrettyPrinterback to summary
public PrettyPrinter getDefaultPrettyPrinter()

Accessor for configured blueprint "default" 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.

Since
2.6
getFilterProviderback to summary
public FilterProvider getFilterProvider()

Method for getting provider used for locating filters given id (which is usually provided with filter annotations). Will be null if no provided was set for ObjectWriter (or if serialization directly called from ObjectMapper)

getSerializationFeaturesback to summary
public final int getSerializationFeatures()
getSerializationInclusionback to summary
public JsonInclude.Include getSerializationInclusion()

Deprecated

Since 2.7 use getDefaultPropertyInclusion instead

Annotations
@Deprecated
hasSerializationFeaturesback to summary
public final boolean hasSerializationFeatures(int featureMask)

"Bulk" access method for checking that all features specified by mask are enabled.

Since
2.3
initializeback to summary
public void initialize(JsonGenerator g)

Method called by ObjectMapper and ObjectWriter to modify those com.fasterxml.jackson.core.JsonGenerator.Feature settings that have been configured via this config instance.

Since
2.5
introspectback to summary
public BeanDescription introspect(JavaType type)

Method that will introspect full bean properties for the purpose of building a bean serializer

isEnabledback to summary
public final boolean isEnabled(SerializationFeature feature)

Accessor for checking whether give SerializationFeature is enabled or not.

Parameters
feature:SerializationFeature

Feature to check

Returns:boolean

True if feature is enabled; false otherwise

isEnabledback to summary
public final boolean isEnabled(JsonGenerator.Feature f, JsonFactory factory)

Accessor method that first checks if we have any overrides for feature, and only if not, checks state of passed-in factory.

Since
2.5
isEnabledback to summary
public final boolean isEnabled(DatatypeFeature feature)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfig.isEnabled.

Accessor for checking whether give DatatypeFeature is enabled or not.

Parameters
feature:DatatypeFeature

Feature to check

Returns:boolean

True if feature is enabled; false otherwise

Annotations
@Override
Since
2.14
useRootWrappingback to summary
public boolean useRootWrapping()

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfig.useRootWrapping.

Doc from com.fasterxml.jackson.databind.cfg.MapperConfig.useRootWrapping.

Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.

Annotations
@Override
withback to summary
public SerializationConfig with(SubtypeResolver str)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase.with.

Doc from com.fasterxml.jackson.databind.cfg.MapperConfigBase.with.

Method for constructing and returning a new instance with different SubtypeResolver to use.

Note

make sure to register new instance with ObjectMapper if directly calling this method.

Annotations
@Override
withback to summary
public SerializationConfig with(ContextAttributes attrs)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase.with.

Doc from com.fasterxml.jackson.databind.cfg.MapperConfigBase.with.

Method for constructing an instance that has specified contextual attributes.

Annotations
@Override
withback to summary
public SerializationConfig with(DateFormat df)

Overrides com.fasterxml.jackson.databind.cfg.MapperConfigBase.with.

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)

Annotations
@Override
withback to summary
public SerializationConfig with(SerializationFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

withback to summary
public SerializationConfig with(SerializationFeature first, SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

withback to summary
public SerializationConfig with(JsonGenerator.Feature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

Since
2.5
withback to summary
public SerializationConfig with(FormatFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

Since
2.7
withback to summary
public SerializationConfig with(ConstructorDetector ctorDetector)
Since
2.18
withDefaultPrettyPrinterback to summary
public SerializationConfig withDefaultPrettyPrinter(PrettyPrinter pp)
Since
2.6
withFeaturesback to summary
public SerializationConfig withFeatures(SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

withFeaturesback to summary
public SerializationConfig withFeatures(JsonGenerator.Feature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

Since
2.5
withFeaturesback to summary
public SerializationConfig withFeatures(FormatFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

Since
2.7
withFiltersback to summary
public SerializationConfig withFilters(FilterProvider filterProvider)
withoutback to summary
public SerializationConfig without(SerializationFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

withoutback to summary
public SerializationConfig without(SerializationFeature first, SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

withoutback to summary
public SerializationConfig without(JsonGenerator.Feature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

Since
2.5
withoutback to summary
public SerializationConfig without(FormatFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

Since
2.7
withoutFeaturesback to summary
public SerializationConfig withoutFeatures(SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

withoutFeaturesback to summary
public SerializationConfig withoutFeatures(JsonGenerator.Feature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

Since
2.5
withoutFeaturesback to summary
public SerializationConfig withoutFeatures(FormatFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

Since
2.7
withPropertyInclusionback to summary
public SerializationConfig withPropertyInclusion(JsonInclude.Value incl)

Deprecated

Since 2.9; not needed any more

Mutant factory method for constructing a new instance with different default inclusion criteria configuration.

Annotations
@Deprecated
Since
2.7
withRootNameback to summary
public SerializationConfig withRootName(PropertyName rootName)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase.withRootName.

Doc from com.fasterxml.jackson.databind.cfg.MapperConfigBase.withRootName.

Method for constructing and returning a new instance with different root name to use (none, if null).

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.

Parameters
rootName:PropertyName

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.

Annotations
@Override
withViewback to summary
public SerializationConfig withView(Class<?> view)

Implements abstract com.fasterxml.jackson.databind.cfg.MapperConfigBase.withView.

Doc from com.fasterxml.jackson.databind.cfg.MapperConfigBase.withView.

Method for constructing and returning a new instance with different view to use.

Annotations
@Override