com.fasterxml.jackson.databind.cfg

Class MapperConfig<T extends MapperConfig<T>>

    • Field Detail

      • _mapperFeatures

        protected final int _mapperFeatures
        Set of shared mapper features enabled.
      • _base

        protected final BaseSettings _base
        Immutable container object for simple configuration settings.
    • Method Detail

      • collectFeatureDefaults

        public static <F extends Enum<F> & ConfigFeature> int collectFeatureDefaults(Class<F> enumClass)
        Method that calculates bit set (flags) of all features that are enabled by default.
      • with

        public abstract T with(MapperFeature... features)
        Method for constructing and returning a new instance with specified mapper features enabled.
      • without

        public abstract T without(MapperFeature... features)
        Method for constructing and returning a new instance with specified mapper features disabled.
      • with

        public abstract T with(MapperFeature feature,
             boolean state)
        Since:
        2.3
      • isEnabled

        public final boolean isEnabled(MapperFeature f)
        Accessor for simple mapper features (which are shared for serialization, deserialization)
      • hasMapperFeatures

        public final boolean hasMapperFeatures(int featureMask)
        "Bulk" access method for checking that all features specified by mask are enabled.
        Since:
        2.3
      • isAnnotationProcessingEnabled

        public final boolean isAnnotationProcessingEnabled()
        Method for determining whether annotation processing is enabled or not (default settings are typically that it is enabled; must explicitly disable).
        Returns:
        True if annotation processing is enabled; false if not
      • canOverrideAccessModifiers

        public final boolean canOverrideAccessModifiers()
        Accessor for determining whether it is ok to try to force override of access modifiers to be able to get or set values of non-public Methods, Fields; to invoke non-public Constructors, Methods; or to instantiate non-public Classes. By default this is enabled, but on some platforms it needs to be prevented since if this would violate security constraints and cause failures.
        Returns:
        True if access modifier overriding is allowed (and may be done for any Field, Method, Constructor or Class); false to prevent any attempts to override.
      • shouldSortPropertiesAlphabetically

        public final boolean shouldSortPropertiesAlphabetically()
        Accessor for checking whether default settings for property handling indicate that properties should be alphabetically ordered or not.
      • useRootWrapping

        public abstract 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.
      • compileString

        public SerializableString compileString(String src)
        Method for constructing a specialized textual object that can typically be serialized faster than basic String (depending on escaping needed if any, char-to-byte encoding if needed).
        Parameters:
        src - Text to represent
        Returns:
        Optimized text object constructed
        Since:
        2.4
      • getAnnotationIntrospector

        public AnnotationIntrospector getAnnotationIntrospector()
        Method for getting AnnotationIntrospector configured to introspect annotation values used for configuration.

        Non-final since it is actually overridden by sub-classes (for now?)

      • getDefaultVisibilityChecker

        public 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). 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)
      • getDefaultTyper

        public final TypeResolverBuilder<?> getDefaultTyper(JavaType baseType)
        Method called to locate a type info handler for types that do not have one explicitly declared via annotations (or other configuration). If such default handler is configured, it is returned; otherwise null is returned.
      • getSubtypeResolver

        public abstract SubtypeResolver getSubtypeResolver()
      • getTypeFactory

        public final TypeFactory getTypeFactory()
      • constructType

        public final JavaType constructType(Class<?> cls)
        Helper method that will construct JavaType for given raw class. This is a simple short-cut for:
            getTypeFactory().constructType(cls);
        
      • constructType

        public final JavaType constructType(TypeReference<?> valueTypeRef)
        Helper method that will construct JavaType for given type reference This is a simple short-cut for:
            getTypeFactory().constructType(valueTypeRef);
        
      • constructSpecializedType

        public JavaType constructSpecializedType(JavaType baseType,
                                        Class<?> subclass)
      • introspectClassAnnotations

        public BeanDescription introspectClassAnnotations(Class<?> cls)
        Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed.
      • introspectClassAnnotations

        public abstract BeanDescription introspectClassAnnotations(JavaType type)
        Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed.
      • introspectDirectClassAnnotations

        public BeanDescription introspectDirectClassAnnotations(Class<?> cls)
        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.
      • introspectDirectClassAnnotations

        public abstract 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.
      • getDefaultPropertyInclusion

        public abstract JsonInclude.Value getDefaultPropertyInclusion()
        Accessor for default property inclusion to use for serialization, used unless overridden by per-type or per-property overrides.
        Since:
        2.7
      • getDefaultPropertyInclusion

        public abstract JsonInclude.Value getDefaultPropertyInclusion(Class<?> baseType)
        Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type.
        NOTE: if no override found, defaults to value returned by getDefaultPropertyInclusion().
        Since:
        2.7
      • getDefaultPropertyInclusion

        public abstract JsonInclude.Value getDefaultPropertyInclusion(Class<?> baseType,
                                                    JsonInclude.Value defaultIncl)
        Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type; but if none found, returning given defaultIncl
        Parameters:
        defaultIncl - Inclusion setting to return if no overrides found.
        Since:
        2.8.2
      • getDefaultPropertyFormat

        public abstract JsonFormat.Value getDefaultPropertyFormat(Class<?> baseType)
        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).
        Since:
        2.7
      • getDefaultPropertyIgnorals

        public abstract JsonIgnoreProperties.Value getDefaultPropertyIgnorals(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". If both exist, config overrides have precedence over class annotations.
        Since:
        2.8
      • findConfigOverride

        public abstract ConfigOverride findConfigOverride(Class<?> type)
        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.
        Returns:
        Override object if there is an override for specified type; `null` if not
        Since:
        2.8
      • getDateFormat

        public final DateFormat getDateFormat()
        Method for accessing currently configured (textual) date format that will be used for reading or writing date values (in case of writing, only if textual output is configured; not if dates are to be serialized as time stamps).

        Note that typically DateFormat instances are not thread-safe (at least ones provided by JDK): this means that calling code should clone format instance before using it.

        This method is usually only called by framework itself, since there are convenience methods available via DeserializationContext and SerializerProvider that take care of cloning and thread-safe reuse.

      • getLocale

        public final Locale getLocale()
        Method for accessing the default Locale to use for formatting, unless overridden by local annotations. Initially set to Locale.getDefault().
      • getTimeZone

        public final TimeZone getTimeZone()
        Method for accessing the default TimeZone to use for formatting, unless overridden by local annotations. Initially set to TimeZone.getDefault().
      • getActiveView

        public abstract Class<?> getActiveView()
        Accessor for finding currently active view, if any (null if none)
      • getBase64Variant

        public Base64Variant getBase64Variant()
        Method called during deserialization if Base64 encoded content needs to be decoded. Default version just returns default Jackson uses, which is modified-mime which does not add linefeeds (because those would have to be escaped in JSON strings); but this can be configured on ObjectWriter.
      • getAttributes

        public abstract ContextAttributes getAttributes()
        Method for accessing per-instance shared (baseline/default) attribute values; these are used as the basis for per-call attributes.
        Since:
        2.3
      • findRootName

        public abstract PropertyName findRootName(Class<?> rawRootType)
        Since:
        2.6
      • typeIdResolverInstance

        public TypeIdResolver typeIdResolverInstance(Annotated annotated,
                                            Class<? extends TypeIdResolver> resolverClass)
        Method that can be called to obtain an instance of TypeIdResolver of specified type.

Copyright © 2008–2017 FasterXML. All rights reserved.