com.fasterxml.jackson.databind.cfg

## Class MapperConfigBase<CFG extends ConfigFeature,T extends MapperConfigBase<CFG,T>>

- java.lang.Object
- - com.fasterxml.jackson.databind.cfg.MapperConfig<T>
  - - com.fasterxml.jackson.databind.cfg.MapperConfigBase<CFG,T>

- All Implemented Interfaces:
    ClassIntrospector.MixInResolver, java.io.Serializable
  Direct Known Subclasses:
    DeserializationConfig, SerializationConfig

      public abstract class MapperConfigBase<CFG extends ConfigFeature,T extends MapperConfigBase<CFG,T>>
      extends MapperConfig<T>
      implements java.io.Serializable

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ContextAttributes` | `_attributes` Contextual attributes accessible (get and set) during processing, on per-call basis.
    `protected ConfigOverrides` | `_configOverrides` Configuration overrides to apply, keyed by type of property.
    `protected SimpleMixInResolver` | `_mixIns` Mix-in annotation mappings to use, if any: immutable, can not be changed once defined.
    `protected PropertyName` | `_rootName` Explicitly defined root name to use, if any; if empty String, will disable root-name wrapping; if null, will use defaults
    `protected RootNameLookup` | `_rootNames` Simple cache used for finding out possible root name for root name wrapping.
    `protected SubtypeResolver` | `_subtypeResolver` Registered concrete subtypes that can be used instead of (or in addition to) ones declared using annotations.
    `protected java.lang.Class<?>` | `_view` View to use for filtering out properties to serialize or deserialize.

    - ### Fields inherited from class com.fasterxml.jackson.databind.cfg.MapperConfig

      `_base, _mapperFeatures, EMPTY_FORMAT, EMPTY_INCLUDE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `MapperConfigBase(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames)` Deprecated. Since 2.8, remove from 2.9 or later
    `protected` | `MapperConfigBase(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)` Constructor used when creating a new instance (compared to that of creating fluent copies)
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src)` Pass-through constructor used when no changes are needed to the base class.
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src, BaseSettings base)`
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src, java.lang.Class<?> view)`
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src, ContextAttributes attr)`
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src, int mapperFeatures)`
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src, PropertyName rootName)`
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src, SimpleMixInResolver mixins)`
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)`
    `protected` | `MapperConfigBase(MapperConfigBase<CFG,T> src, SubtypeResolver str)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ClassIntrospector.MixInResolver` | `copy()` Method called to create a new, non-shared copy, to be used by different `ObjectMapper` instance, and one that should not be connected to this instance, if resolver has mutable state.
    `ConfigOverride` | `findConfigOverride(java.lang.Class<?> type)` Accessor for finding possible `ConfigOverride` to use for properties of given type.
    `java.lang.Class<?>` | `findMixInClassFor(java.lang.Class<?> cls)` Method that will check if there are "mix-in" classes (with mix-in annotations) for given class
    `PropertyName` | `findRootName(java.lang.Class<?> rawRootType)`
    `PropertyName` | `findRootName(JavaType rootType)`
    `java.lang.Class<?>` | `getActiveView()` Accessor for finding currently active view, if any (null if none)
    `ContextAttributes` | `getAttributes()` Method for accessing per-instance shared (baseline/default) attribute values; these are used as the basis for per-call attributes.
    `com.fasterxml.jackson.annotation.JsonFormat.Value` | `getDefaultPropertyFormat(java.lang.Class<?> type)` Accessor for default format settings to use for serialization (and, to a degree deserialization), considering baseline settings and per-type defaults for given base type (if any).
    `com.fasterxml.jackson.annotation.JsonIgnoreProperties.Value` | `getDefaultPropertyIgnorals(java.lang.Class<?> type)` Accessor for default property ignorals to use, if any, for given base type, based on config overrides settings (see `MapperConfig.findConfigOverride(Class)`).
    `com.fasterxml.jackson.annotation.JsonIgnoreProperties.Value` | `getDefaultPropertyIgnorals(java.lang.Class<?> baseType, AnnotatedClass actualClass)` Helper method that may be called to see if there are property ignoral definitions from annotations (via `AnnotatedClass`) or through "config overrides".
    `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).
    `PropertyName` | `getFullRootName()`
    `java.lang.String` | `getRootName()` Deprecated. Since 2.6 use `getFullRootName()` instead.
    `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).
    `int` | `mixInCount()` Test-only method -- does not reflect possibly open-ended set that external mix-in resolver might provide.
    `abstract T` | `with(AnnotationIntrospector ai)` Method for constructing and returning a new instance with different `AnnotationIntrospector` to use (replacing old one).
    `abstract T` | `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.
    `abstract T` | `with(ClassIntrospector ci)` Method for constructing and returning a new instance with different `ClassIntrospector` to use.
    `abstract T` | `with(ContextAttributes attrs)` Method for constructing an instance that has specified contextual attributes.
    `abstract T` | `with(java.text.DateFormat df)` Method for constructing and returning a new instance with different `DateFormat` to use.
    `abstract T` | `with(HandlerInstantiator hi)` Method for constructing and returning a new instance with different `HandlerInstantiator` to use.
    `abstract T` | `with(java.util.Locale l)` Method for constructing and returning a new instance with different default `Locale` to use for formatting.
    `abstract T` | `with(PropertyNamingStrategy strategy)` Method for constructing and returning a new instance with different `PropertyNamingStrategy` to use.
    `abstract T` | `with(SubtypeResolver str)` Method for constructing and returning a new instance with different `SubtypeResolver` to use.
    `abstract T` | `with(java.util.TimeZone tz)` Method for constructing and returning a new instance with different default `TimeZone` to use for formatting of date values.
    `abstract T` | `with(TypeFactory typeFactory)` Method for constructing and returning a new instance with different `TypeFactory` to use.
    `abstract T` | `with(TypeResolverBuilder<?> trb)` Method for constructing and returning a new instance with different `TypeResolverBuilder` to use.
    `abstract T` | `with(VisibilityChecker<?> vc)` Method for constructing and returning a new instance with different `VisibilityChecker` to use.
    `abstract T` | `withAppendedAnnotationIntrospector(AnnotationIntrospector introspector)` Method for constructing and returning a new instance with additional `AnnotationIntrospector` appended (as the lowest priority one)
    `T` | `withAttribute(java.lang.Object key, java.lang.Object value)` Method for constructing an instance that has specified value for attribute for given key.
    `T` | `withAttributes(java.util.Map<?,?> attributes)` Method for constructing an instance that has only specified attributes, removing any attributes that exist before the call.
    `abstract T` | `withInsertedAnnotationIntrospector(AnnotationIntrospector introspector)` Method for constructing and returning a new instance with additional `AnnotationIntrospector` inserted (as the highest priority one)
    `T` | `withoutAttribute(java.lang.Object key)` Method for constructing an instance that has no value for attribute for given key.
    `abstract T` | `withRootName(PropertyName rootName)` Method for constructing and returning a new instance with different root name to use (none, if null).
    `T` | `withRootName(java.lang.String rootName)`
    `abstract T` | `withView(java.lang.Class<?> view)` Method for constructing and returning a new instance with different view to use.
    `abstract T` | `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

    - ### Methods inherited from class com.fasterxml.jackson.databind.cfg.MapperConfig

      `canOverrideAccessModifiers, collectFeatureDefaults, compileString, constructSpecializedType, constructType, constructType, getAnnotationIntrospector, getBase64Variant, getClassIntrospector, getDateFormat, getDefaultPropertyInclusion, getDefaultPropertyInclusion, getDefaultPropertyInclusion, getDefaultTyper, getHandlerInstantiator, getLocale, getPropertyNamingStrategy, getTimeZone, getTypeFactory, hasMapperFeatures, introspectClassAnnotations, introspectClassAnnotations, introspectDirectClassAnnotations, introspectDirectClassAnnotations, isAnnotationProcessingEnabled, isEnabled, shouldSortPropertiesAlphabetically, typeIdResolverInstance, typeResolverBuilderInstance, useRootWrapping, with, with, without`

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

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

- - ### Field Detail

    - #### _mixIns

          protected final SimpleMixInResolver _mixIns

      Mix-in annotation mappings to use, if any: immutable, can not be changed once defined.
      Since:
        2.6

    - #### _subtypeResolver

          protected final SubtypeResolver _subtypeResolver

      Registered concrete subtypes that can be used instead of (or in addition to) ones declared using annotations.

      Note that instances are stateful and as such may need to be copied, and may NOT be demoted down to `BaseSettings`.

    - #### _rootName

          protected final PropertyName _rootName

      Explicitly defined root name to use, if any; if empty String, will disable root-name wrapping; if null, will use defaults

    - #### _view

          protected final java.lang.Class<?> _view

      View to use for filtering out properties to serialize or deserialize. Null if none (will also be assigned null if `Object.class` is defined), meaning that all properties are to be included.

    - #### _attributes

          protected final ContextAttributes _attributes

      Contextual attributes accessible (get and set) during processing, on per-call basis.
      Since:
        2.3

    - #### _rootNames

          protected final RootNameLookup _rootNames

      Simple cache used for finding out possible root name for root name wrapping.

      Note that instances are stateful (for caching) and as such may need to be copied, and may NOT be demoted down to `BaseSettings`.

      Since:
        2.6

    - #### _configOverrides

          protected final ConfigOverrides _configOverrides

      Configuration overrides to apply, keyed by type of property.
      Since:
        2.8

  - ### Constructor Detail

    - #### MapperConfigBase

          protected MapperConfigBase(BaseSettings base,
                          SubtypeResolver str,
                          SimpleMixInResolver mixins,
                          RootNameLookup rootNames,
                          ConfigOverrides configOverrides)

      Constructor used when creating a new instance (compared to that of creating fluent copies)
      Since:
        2.8

    - #### MapperConfigBase

          @Deprecated
          protected MapperConfigBase(BaseSettings base,
                                     SubtypeResolver str,
                                     SimpleMixInResolver mixins,
                                     RootNameLookup rootNames)

      Deprecated. Since 2.8, remove from 2.9 or later

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src)

      Pass-through constructor used when no changes are needed to the base class.

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src,
                          BaseSettings base)

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src,
                          int mapperFeatures)

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src,
                          SubtypeResolver str)

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src,
                          PropertyName rootName)

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src,
                          java.lang.Class<?> view)

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src,
                          SimpleMixInResolver mixins)

      Since:
        2.1

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src,
                          ContextAttributes attr)

      Since:
        2.3

    - #### MapperConfigBase

          protected MapperConfigBase(MapperConfigBase<CFG,T> src,
                          SimpleMixInResolver mixins,
                          RootNameLookup rootNames,
                          ConfigOverrides configOverrides)

      Since:
        2.8

  - ### Method Detail

    - #### getDefaultVisibilityChecker

          public VisibilityChecker<?> getDefaultVisibilityChecker()

      Description copied from class: `MapperConfig`
      Accessor for object used for determining whether specific property elements (method, constructors, fields) can be auto-detected based on their visibility (access modifiers). Can be changed to allow different minimum visibility levels for auto-detection. Note that this is the global handler; individual types (classes) can further override active checker used (using `JsonAutoDetect` annotation)
      Overrides:
        `getDefaultVisibilityChecker` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### with

          public abstract T with(AnnotationIntrospector ai)

      Method for constructing and returning a new instance with different `AnnotationIntrospector` to use (replacing old one).

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

    - #### withAppendedAnnotationIntrospector

          public abstract T withAppendedAnnotationIntrospector(AnnotationIntrospector introspector)

      Method for constructing and returning a new instance with additional `AnnotationIntrospector` appended (as the lowest priority one)

    - #### withInsertedAnnotationIntrospector

          public abstract T withInsertedAnnotationIntrospector(AnnotationIntrospector introspector)

      Method for constructing and returning a new instance with additional `AnnotationIntrospector` inserted (as the highest priority one)

    - #### with

          public abstract T with(ClassIntrospector ci)

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

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

    - #### with

          public abstract T with(java.text.DateFormat df)

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

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

    - #### with

          public abstract T with(HandlerInstantiator hi)

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

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

    - #### with

          public abstract T with(PropertyNamingStrategy strategy)

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

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

    - #### withRootName

          public abstract T withRootName(PropertyName rootName)

      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` - 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.
      Since:
        2.6

    - #### withRootName

          public T withRootName(java.lang.String rootName)

    - #### with

          public abstract T with(SubtypeResolver str)

      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.

    - #### with

          public abstract T with(TypeFactory typeFactory)

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

    - #### with

          public abstract T with(TypeResolverBuilder<?> trb)

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

    - #### withView

          public abstract T withView(java.lang.Class<?> view)

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

    - #### with

          public abstract T with(VisibilityChecker<?> vc)

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

    - #### withVisibility

          public abstract T 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

    - #### with

          public abstract T with(java.util.Locale l)

      Method for constructing and returning a new instance with different default `Locale` to use for formatting.

    - #### with

          public abstract T with(java.util.TimeZone tz)

      Method for constructing and returning a new instance with different default `TimeZone` to use for formatting of date values.

    - #### with

          public abstract T 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.

    - #### with

          public abstract T with(ContextAttributes attrs)

      Method for constructing an instance that has specified contextual attributes.
      Since:
        2.3

    - #### withAttributes

          public T withAttributes(java.util.Map<?,?> attributes)

      Method for constructing an instance that has only specified attributes, removing any attributes that exist before the call.
      Since:
        2.3

    - #### withAttribute

          public T withAttribute(java.lang.Object key,
                        java.lang.Object value)

      Method for constructing an instance that has specified value for attribute for given key.
      Since:
        2.3

    - #### withoutAttribute

          public T withoutAttribute(java.lang.Object key)

      Method for constructing an instance that has no value for attribute for given key.
      Since:
        2.3

    - #### getSubtypeResolver

          public final 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).
      Specified by:
        `getSubtypeResolver` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### getRootName

          @Deprecated
          public final java.lang.String getRootName()

      Deprecated. Since 2.6 use `getFullRootName()` instead.

    - #### getFullRootName

          public final PropertyName getFullRootName()

      Since:
        2.6

    - #### getActiveView

          public final java.lang.Class<?> getActiveView()

      Description copied from class: `MapperConfig`
      Accessor for finding currently active view, if any (null if none)
      Specified by:
        `getActiveView` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### getAttributes

          public final ContextAttributes getAttributes()

      Description copied from class: `MapperConfig`
      Method for accessing per-instance shared (baseline/default) attribute values; these are used as the basis for per-call attributes.
      Specified by:
        `getAttributes` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### findConfigOverride

          public final ConfigOverride findConfigOverride(java.lang.Class<?> type)

      Description copied from class: `MapperConfig`
      Accessor for finding possible `ConfigOverride` to use for properties of given type. Note that only directly associate override is found; no type hierarchy traversal is performed.
      Specified by:
        `findConfigOverride` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`
      Returns:
        Override object if there is an override for specified type; `null` if not

    - #### getDefaultPropertyFormat

          public final com.fasterxml.jackson.annotation.JsonFormat.Value getDefaultPropertyFormat(java.lang.Class<?> type)

      Description copied from class: `MapperConfig`
      Accessor for default format settings to use for serialization (and, to a degree deserialization), considering baseline settings and per-type defaults for given base type (if any).
      Specified by:
        `getDefaultPropertyFormat` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### getDefaultPropertyIgnorals

          public final com.fasterxml.jackson.annotation.JsonIgnoreProperties.Value getDefaultPropertyIgnorals(java.lang.Class<?> type)

      Description copied from class: `MapperConfig`
      Accessor for default property ignorals to use, if any, for given base type, based on config overrides settings (see `MapperConfig.findConfigOverride(Class)`).
      Specified by:
        `getDefaultPropertyIgnorals` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### getDefaultPropertyIgnorals

          public final com.fasterxml.jackson.annotation.JsonIgnoreProperties.Value getDefaultPropertyIgnorals(java.lang.Class<?> baseType,
                                                                                               AnnotatedClass actualClass)

      Description copied from class: `MapperConfig`
      Helper method that may be called to see if there are property ignoral definitions from annotations (via `AnnotatedClass`) or through "config overrides". If both exist, config overrides have precedence over class annotations.
      Specified by:
        `getDefaultPropertyIgnorals` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### findRootName

          public PropertyName findRootName(JavaType rootType)

      Specified by:
        `findRootName` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### findRootName

          public PropertyName findRootName(java.lang.Class<?> rawRootType)

      Specified by:
        `findRootName` in class `MapperConfig<T extends MapperConfigBase<CFG,T>>`

    - #### findMixInClassFor

          public final java.lang.Class<?> findMixInClassFor(java.lang.Class<?> cls)

      Method that will check if there are "mix-in" classes (with mix-in annotations) for given class
      Specified by:
        `findMixInClassFor` in interface `ClassIntrospector.MixInResolver`

    - #### copy

          public ClassIntrospector.MixInResolver copy()

      Description copied from interface: `ClassIntrospector.MixInResolver`
      Method called to create a new, non-shared copy, to be used by different `ObjectMapper` instance, and one that should not be connected to this instance, if resolver has mutable state. If resolver is immutable may simply return `this`.
      Specified by:
        `copy` in interface `ClassIntrospector.MixInResolver`

    - #### mixInCount

          public final int mixInCount()

      Test-only method -- does not reflect possibly open-ended set that external mix-in resolver might provide.