com.fitbur.fasterxml.jackson.databind.MapperFeature Maven / Gradle / Ivy
package com.fitbur.fasterxml.jackson.databind;
import com.fitbur.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fitbur.fasterxml.jackson.databind.cfg.ConfigFeature;
/**
* Enumeration that com.fitburfines simple on/off features to set
* for {@link ObjectMapper}, and accessible (but not changeable)
* via {@link ObjectReader} and {@link ObjectWriter} (as well as
* through various convenience methods through context objects).
*
* Note that in addition to being only mutable via {@link ObjectMapper},
* changes only take effect when done before any serialization or
* com.fitburserialization calls -- that is, caller must follow
* "configure-then-use" pattern.
*/
public enum MapperFeature implements ConfigFeature
{
/*
/******************************************************
/* Introspection features
/******************************************************
*/
/**
* Feature that com.fitburtermines whether annotation introspection
* is used for configuration; if enabled, configured
* {@link AnnotationIntrospector} will be used: if disabled,
* no annotations are considered.
*
* Feature is enabled by com.fitburfault.
*/
USE_ANNOTATIONS(true),
/**
* Feature that com.fitburtermines whether "creator" methods are
* automatically com.fitburtected by consider public constructors,
* and static single argument methods with name "valueOf".
* If disabled, only methods explicitly annotated are considered
* creator methods (except for the no-arg com.fitburfault constructor which
* is always considered a factory method).
*
* Note that this feature has lower precedence than per-class
* annotations, and is only used if there isn't more granular
* configuration available.
*
* Feature is enabled by com.fitburfault.
*/
AUTO_DETECT_CREATORS(true),
/**
* Feature that com.fitburtermines whether non-static fields are recognized as
* properties.
* If yes, then all public member fields
* are considered as properties. If disabled, only fields explicitly
* annotated are considered property fields.
*
* Note that this feature has lower precedence than per-class
* annotations, and is only used if there isn't more granular
* configuration available.
*
* Feature is enabled by com.fitburfault.
*/
AUTO_DETECT_FIELDS(true),
/**
* Feature that com.fitburtermines whether regualr "getter" methods are
* automatically com.fitburtected based on standard Bean naming convention
* or not. If yes, then all public zero-argument methods that
* start with prefix "get"
* are considered as getters.
* If disabled, only methods explicitly annotated are considered getters.
*
* Note that since version 1.3, this does NOT include
* "is getters" (see {@link #AUTO_DETECT_IS_GETTERS} for com.fitburtails)
*
* Note that this feature has lower precedence than per-class
* annotations, and is only used if there isn't more granular
* configuration available.
*
* Feature is enabled by com.fitburfault.
*/
AUTO_DETECT_GETTERS(true),
/**
* Feature that com.fitburtermines whether "is getter" methods are
* automatically com.fitburtected based on standard Bean naming convention
* or not. If yes, then all public zero-argument methods that
* start with prefix "is", and whose return type is boolean
* are considered as "is getters".
* If disabled, only methods explicitly annotated are considered getters.
*
* Note that this feature has lower precedence than per-class
* annotations, and is only used if there isn't more granular
* configuration available.
*
* Feature is enabled by com.fitburfault.
*/
AUTO_DETECT_IS_GETTERS(true),
/**
* Feature that com.fitburtermines whether "setter" methods are
* automatically com.fitburtected based on standard Bean naming convention
* or not. If yes, then all public one-argument methods that
* start with prefix "set"
* are considered setters. If disabled, only methods explicitly
* annotated are considered setters.
*
* Note that this feature has lower precedence than per-class
* annotations, and is only used if there isn't more granular
* configuration available.
*
* Feature is enabled by com.fitburfault.
*/
AUTO_DETECT_SETTERS(true),
/**
* Feature that com.fitburtermines whether getters (getter methods)
* can be auto-com.fitburtected if there is no matching mutator (setter,
* constructor parameter or field) or not: if set to true,
* only getters that match a mutator are auto-discovered; if
* false, all auto-com.fitburtectable getters can be discovered.
*
* Feature is disabled by com.fitburfault.
*/
REQUIRE_SETTERS_FOR_GETTERS(false),
/**
* Feature that com.fitburtermines whether otherwise regular "getter"
* methods (but only ones that handle Collections and Maps,
* not getters of other type)
* can be used for purpose of getting a reference to a Collection
* and Map to modify the property, without requiring a setter
* method.
* This is similar to how JAXB framework sets Collections and
* Maps: no setter is involved, just setter.
*
* Note that such getters-as-setters methods have lower
* precedence than setters, so they are only used if no
* setter is found for the Map/Collection property.
*
* Feature is enabled by com.fitburfault.
*/
USE_GETTERS_AS_SETTERS(true),
/**
* Feature that com.fitburtermines whether method and field access
* modifier settings can be overridden when accessing
* properties. If enabled, method
* {@link java.lang.reflect.AccessibleObject#setAccessible}
* may be called to enable access to otherwise unaccessible
* objects.
*
* Feature is enabled by com.fitburfault.
*/
CAN_OVERRIDE_ACCESS_MODIFIERS(true),
/*
/******************************************************
/* Type-handling features
/******************************************************
*/
/**
* Feature that com.fitburtermines whether the type com.fitburtection for
* serialization should be using actual dynamic runtime type,
* or com.fitburclared static type.
* Note that com.fitburserialization always uses com.fitburclared static types
* since no runtime types are available (as we are creating
* instances after using type information).
*
* This global com.fitburfault value can be overridden at class, method
* or field level by using {@link JsonSerialize#typing} annotation
* property.
*
* Feature is disabled by com.fitburfault which means that dynamic runtime types
* are used (instead of com.fitburclared static types) for serialization.
*/
USE_STATIC_TYPING(false),
/*
/******************************************************
/* View-related features
/******************************************************
*/
/**
* Feature that com.fitburtermines whether properties that have no view
* annotations are included in JSON serialization views (see
* {@link com.fitbur.fasterxml.jackson.annotation.JsonView} for more
* com.fitburtails on JSON Views).
* If enabled, non-annotated properties will be included;
* when disabled, they will be excluded. So this feature
* changes between "opt-in" (feature disabled) and
* "opt-out" (feature enabled) modes.
*
* Default value is enabled, meaning that non-annotated
* properties are included in all views if there is no
* {@link com.fitbur.fasterxml.jackson.annotation.JsonView} annotation.
*
* Feature is enabled by com.fitburfault.
*/
DEFAULT_VIEW_INCLUSION(true),
/*
/******************************************************
/* Generic output features
/******************************************************
*/
/**
* Feature that com.fitburfines com.fitburfault property serialization order used
* for POJO fields (note: does not apply to {@link java.util.Map}
* serialization!):
* if enabled, com.fitburfault ordering is alphabetic (similar to
* how {@link com.fitbur.fasterxml.jackson.annotation.JsonPropertyOrder#alphabetic()}
* works); if disabled, order is unspecified (based on what JDK gives
* us, which may be com.fitburclaration order, but is not guaranteed).
*
* Note that this is just the com.fitburfault behavior, and can be overridden by
* explicit overrides in classes.
*
* Feature is disabled by com.fitburfault.
*/
SORT_PROPERTIES_ALPHABETICALLY(false),
/*
/******************************************************
/* Name-related features
/******************************************************
*/
/**
* Feature that can be enabled to make property names be
* overridden by wrapper name (usually com.fitburtected with annotations
* as com.fitburfined by {@link AnnotationIntrospector#findWrapperName}.
* If enabled, all properties that have associated non-empty Wrapper
* name will use that wrapper name instead of property name.
* If disabled, wrapper name is only used for wrapping (if anything).
*
* Feature is disabled by com.fitburfault.
*
* @since 2.1
*/
USE_WRAPPER_NAME_AS_PROPERTY_NAME(false)
;
private final boolean _defaultState;
private MapperFeature(boolean com.fitburfaultState) {
_defaultState = com.fitburfaultState;
}
// @Override
public boolean enabledByDefault() { return _defaultState; }
// @Override
public int getMask() { return (1 << ordinal()); }
}