com.fasterxml.jackson.databind.cfg

## Class BaseSettings

- java.lang.Object
- - com.fasterxml.jackson.databind.cfg.BaseSettings

All Implemented Interfaces:
  Serializable

    public final class BaseSettings
    extends Object
    implements Serializable

Immutable container class used to store simple configuration settings for both serialization and deserialization. Since instances are fully immutable, instances can be freely shared and used without synchronization.

See Also:
  Serialized Form

### Field Summary

Fields
`protected AccessorNamingStrategy.Provider` `_accessorNaming` Provider for creating `AccessorNamingStrategy` instances to use
`protected AnnotationIntrospector` `_annotationIntrospector` Introspector used for accessing annotation value based configuration.
`protected CacheProvider` `_cacheProvider` Used to provide custom cache implementation in downstream components.
`protected ClassIntrospector` `_classIntrospector` Introspector used to figure out Bean properties needed for bean serialization and deserialization.
`protected DateFormat` `_dateFormat` Custom date format to use for deserialization.
`protected Base64Variant` `_defaultBase64` Explicitly default `Base64Variant` to use for handling binary data (`byte[]`), used with data formats that use base64 encoding (like JSON, CSV).
`protected EnumNamingStrategy` `_enumNamingStrategy` Custom enum naming strategy in use, if any.
`protected HandlerInstantiator` `_handlerInstantiator` Object used for creating instances of handlers (serializers, deserializers, type and type id resolvers), given class to instantiate.
`protected Locale` `_locale` Default `Locale` used with serialization formats.
`protected PropertyNamingStrategy` `_propertyNamingStrategy` Custom property naming strategy in use, if any.
`protected TimeZone` `_timeZone` Default `TimeZone` used with serialization formats, if (and only if!)
`protected TypeFactory` `_typeFactory` Specific factory used for creating `JavaType` instances; needed to allow modules to add more custom type handling (mostly to support types of non-Java JVM languages)
`protected TypeResolverBuilder<?>` `_typeResolverBuilder` Builder used to create type resolver for serializing and deserializing values for which polymorphic type handling is needed.
`protected PolymorphicTypeValidator` `_typeValidator` Validator that is used to limit allowed polymorphic subtypes, mostly for security reasons when dealing with untrusted content.

### Constructor Summary

Constructors
Constructor and Description
`BaseSettings(ClassIntrospector ci, AnnotationIntrospector ai, PropertyNamingStrategy pns, EnumNamingStrategy ens, TypeFactory tf, TypeResolverBuilder<?> typer, DateFormat dateFormat, HandlerInstantiator hi, Locale locale, TimeZone tz, Base64Variant defaultBase64, PolymorphicTypeValidator ptv, AccessorNamingStrategy.Provider accNaming, CacheProvider cacheProvider)`
`BaseSettings(ClassIntrospector ci, AnnotationIntrospector ai, PropertyNamingStrategy pns, TypeFactory tf, TypeResolverBuilder<?> typer, DateFormat dateFormat, HandlerInstantiator hi, Locale locale, TimeZone tz, Base64Variant defaultBase64, PolymorphicTypeValidator ptv, AccessorNamingStrategy.Provider accNaming)` Deprecated. Since 2.16, use variant that takes `CacheProvider` instead.

`BaseSettings(ClassIntrospector ci, AnnotationIntrospector ai, PropertyNamingStrategy pns, TypeFactory tf, TypeResolverBuilder<?> typer, DateFormat dateFormat, HandlerInstantiator hi, Locale locale, TimeZone tz, Base64Variant defaultBase64, PolymorphicTypeValidator ptv, AccessorNamingStrategy.Provider accNaming, CacheProvider cacheProvider)`
Deprecated.
Since 2.19, use variant that takes `EnumNamingStrategy` instead.

### Method Summary

All Methods Instance Methods Concrete Methods
`BaseSettings` `copy()` Turns out we are not necessarily 100% stateless, alas, since `ClassIntrospector` typically has a cache.
`AccessorNamingStrategy.Provider` `getAccessorNaming()`
`AnnotationIntrospector` `getAnnotationIntrospector()`
`Base64Variant` `getBase64Variant()`
`CacheProvider` `getCacheProvider()`
`ClassIntrospector` `getClassIntrospector()`
`DateFormat` `getDateFormat()`
`EnumNamingStrategy` `getEnumNamingStrategy()`
`HandlerInstantiator` `getHandlerInstantiator()`
`Locale` `getLocale()`
`PolymorphicTypeValidator` `getPolymorphicTypeValidator()`
`PropertyNamingStrategy` `getPropertyNamingStrategy()`
`TimeZone` `getTimeZone()`
`TypeFactory` `getTypeFactory()`
`TypeResolverBuilder<?>` `getTypeResolverBuilder()`
`boolean` `hasExplicitTimeZone()` Accessor that may be called to determine whether this settings object has been explicitly configured with a TimeZone (true), or is still relying on the default settings (false).
`BaseSettings` `with(Base64Variant base64)`
`BaseSettings` `with(CacheProvider cacheProvider)` Fluent factory for constructing a new instance with provided `CacheProvider`.
`BaseSettings` `with(Locale l)`
`BaseSettings` `with(PolymorphicTypeValidator v)`
`BaseSettings` `with(TimeZone tz)` Fluent factory for constructing a new instance that uses specified TimeZone.
`BaseSettings` `withAccessorNaming(AccessorNamingStrategy.Provider p)`
`BaseSettings` `withAnnotationIntrospector(AnnotationIntrospector ai)`
`BaseSettings` `withAppendedAnnotationIntrospector(AnnotationIntrospector ai)`
`BaseSettings` `withClassIntrospector(ClassIntrospector ci)`
`BaseSettings` `withDateFormat(DateFormat df)`
`BaseSettings` `withEnumNamingStrategy(EnumNamingStrategy ens)`
`BaseSettings` `withHandlerInstantiator(HandlerInstantiator hi)`
`BaseSettings` `withInsertedAnnotationIntrospector(AnnotationIntrospector ai)`
`BaseSettings` `withPropertyNamingStrategy(PropertyNamingStrategy pns)`
`BaseSettings` `withTypeFactory(TypeFactory tf)`
`BaseSettings` `withTypeResolverBuilder(TypeResolverBuilder<?> typer)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### _typeFactory

    protected final TypeFactory _typeFactory

Specific factory used for creating `JavaType` instances; needed to allow modules to add more custom type handling (mostly to support types of non-Java JVM languages)

#### _classIntrospector

    protected final ClassIntrospector _classIntrospector

Introspector used to figure out Bean properties needed for bean serialization and deserialization. Overridable so that it is possible to change low-level details of introspection, like adding new annotation types.

#### _annotationIntrospector

    protected final AnnotationIntrospector _annotationIntrospector

Introspector used for accessing annotation value based configuration.

#### _propertyNamingStrategy

    protected final PropertyNamingStrategy _propertyNamingStrategy

Custom property naming strategy in use, if any.

#### _enumNamingStrategy

    protected final EnumNamingStrategy _enumNamingStrategy

Custom enum naming strategy in use, if any.

Since:
  2.19

#### _accessorNaming

    protected final AccessorNamingStrategy.Provider _accessorNaming

Provider for creating `AccessorNamingStrategy` instances to use

Since:
  2.12

#### _typeResolverBuilder

    protected final TypeResolverBuilder<?> _typeResolverBuilder

Builder used to create type resolver for serializing and deserializing values for which polymorphic type handling is needed.

#### _typeValidator

    protected final PolymorphicTypeValidator _typeValidator

Validator that is used to limit allowed polymorphic subtypes, mostly for security reasons when dealing with untrusted content.

Since:
  2.10

#### _dateFormat

    protected final DateFormat _dateFormat

Custom date format to use for deserialization. If specified, will be used instead of `StdDateFormat`.

Note that the configured format object will be cloned once per deserialization process (first time it is needed)

#### _handlerInstantiator

    protected final HandlerInstantiator _handlerInstantiator

Object used for creating instances of handlers (serializers, deserializers, type and type id resolvers), given class to instantiate. This is typically used to do additional configuration (with dependency injection, for example) beyond simply construction of instances; or to use alternative constructors.

#### _locale

    protected final Locale _locale

Default `Locale` used with serialization formats. Default value is `Locale.getDefault()`.

#### _timeZone

    protected final TimeZone _timeZone

Default `TimeZone` used with serialization formats, if (and only if!) explicitly set by use; otherwise `null` to indicate "use default", which means "UTC" (from Jackson 2.7); earlier versions (up to 2.6) used "GMT".

Note that if a new value is set, timezone is also assigned to `_dateFormat` of this object.

#### _defaultBase64

    protected final Base64Variant _defaultBase64

Explicitly default `Base64Variant` to use for handling binary data (`byte[]`), used with data formats that use base64 encoding (like JSON, CSV).

Since:
  2.1

#### _cacheProvider

    protected final CacheProvider _cacheProvider

Used to provide custom cache implementation in downstream components.

Since:
  2.16

### Constructor Detail

#### BaseSettings

    public BaseSettings(ClassIntrospector ci,
                        AnnotationIntrospector ai,
                        PropertyNamingStrategy pns,
                        EnumNamingStrategy ens,
                        TypeFactory tf,
                        TypeResolverBuilder<?> typer,
                        DateFormat dateFormat,
                        HandlerInstantiator hi,
                        Locale locale,
                        TimeZone tz,
                        Base64Variant defaultBase64,
                        PolymorphicTypeValidator ptv,
                        AccessorNamingStrategy.Provider accNaming,
                        CacheProvider cacheProvider)

Since:
  2.19

#### BaseSettings

    @Deprecated
    public BaseSettings(ClassIntrospector ci,
                                    AnnotationIntrospector ai,
                                    PropertyNamingStrategy pns,
                                    TypeFactory tf,
                                    TypeResolverBuilder<?> typer,
                                    DateFormat dateFormat,
                                    HandlerInstantiator hi,
                                    Locale locale,
                                    TimeZone tz,
                                    Base64Variant defaultBase64,
                                    PolymorphicTypeValidator ptv,
                                    AccessorNamingStrategy.Provider accNaming,
                                    CacheProvider cacheProvider)

Deprecated. Since 2.19, use variant that takes `EnumNamingStrategy` instead.

Since:
  2.16

#### BaseSettings

    @Deprecated
    public BaseSettings(ClassIntrospector ci,
                                    AnnotationIntrospector ai,
                                    PropertyNamingStrategy pns,
                                    TypeFactory tf,
                                    TypeResolverBuilder<?> typer,
                                    DateFormat dateFormat,
                                    HandlerInstantiator hi,
                                    Locale locale,
                                    TimeZone tz,
                                    Base64Variant defaultBase64,
                                    PolymorphicTypeValidator ptv,
                                    AccessorNamingStrategy.Provider accNaming)

Deprecated. Since 2.16, use variant that takes `CacheProvider` instead.

Since:
  2.12

### Method Detail

#### copy

    public BaseSettings copy()

Turns out we are not necessarily 100% stateless, alas, since `ClassIntrospector` typically has a cache. So this method is needed for deep copy() of Mapper.

Since:
  2.9.6

#### withClassIntrospector

    public BaseSettings withClassIntrospector(ClassIntrospector ci)

#### withAnnotationIntrospector

    public BaseSettings withAnnotationIntrospector(AnnotationIntrospector ai)

#### withInsertedAnnotationIntrospector

    public BaseSettings withInsertedAnnotationIntrospector(AnnotationIntrospector ai)

#### withAppendedAnnotationIntrospector

    public BaseSettings withAppendedAnnotationIntrospector(AnnotationIntrospector ai)

#### withPropertyNamingStrategy

    public BaseSettings withPropertyNamingStrategy(PropertyNamingStrategy pns)

#### withEnumNamingStrategy

    public BaseSettings withEnumNamingStrategy(EnumNamingStrategy ens)

Since:
  2.19

#### withAccessorNaming

    public BaseSettings withAccessorNaming(AccessorNamingStrategy.Provider p)

#### withTypeFactory

    public BaseSettings withTypeFactory(TypeFactory tf)

#### withTypeResolverBuilder

    public BaseSettings withTypeResolverBuilder(TypeResolverBuilder<?> typer)

#### withDateFormat

    public BaseSettings withDateFormat(DateFormat df)

#### withHandlerInstantiator

    public BaseSettings withHandlerInstantiator(HandlerInstantiator hi)

#### with

    public BaseSettings with(Locale l)

#### with

    public BaseSettings with(TimeZone tz)

Fluent factory for constructing a new instance that uses specified TimeZone. Note that timezone used with also be assigned to configured `DateFormat`, changing time formatting defaults.

#### with

    public BaseSettings with(Base64Variant base64)

Since:
  2.1

#### with

    public BaseSettings with(PolymorphicTypeValidator v)

Since:
  2.10

#### with

    public BaseSettings with(CacheProvider cacheProvider)

Fluent factory for constructing a new instance with provided `CacheProvider`.

Returns:
  a new instance with provided `CacheProvider`.
Since:
  2.16

#### getClassIntrospector

    public ClassIntrospector getClassIntrospector()

#### getAnnotationIntrospector

    public AnnotationIntrospector getAnnotationIntrospector()

#### getPropertyNamingStrategy

    public PropertyNamingStrategy getPropertyNamingStrategy()

#### getEnumNamingStrategy

    public EnumNamingStrategy getEnumNamingStrategy()

Since:
  2.19

#### getAccessorNaming

    public AccessorNamingStrategy.Provider getAccessorNaming()

#### getTypeFactory

    public TypeFactory getTypeFactory()

#### getTypeResolverBuilder

    public TypeResolverBuilder<?> getTypeResolverBuilder()

#### getPolymorphicTypeValidator

    public PolymorphicTypeValidator getPolymorphicTypeValidator()

Since:
  2.10

#### getDateFormat

    public DateFormat getDateFormat()

#### getHandlerInstantiator

    public HandlerInstantiator getHandlerInstantiator()

#### getLocale

    public Locale getLocale()

#### getTimeZone

    public TimeZone getTimeZone()

#### hasExplicitTimeZone

    public boolean hasExplicitTimeZone()

Accessor that may be called to determine whether this settings object has been explicitly configured with a TimeZone (true), or is still relying on the default settings (false).

Since:
  2.7

#### getBase64Variant

    public Base64Variant getBase64Variant()

#### getCacheProvider

    public CacheProvider getCacheProvider()

Since:
  2.16