Package com.fasterxml.jackson.core
Enum JsonFactory.Feature
- java.lang.Object
-
- java.lang.Enum<JsonFactory.Feature>
-
- com.fasterxml.jackson.core.JsonFactory.Feature
-
- All Implemented Interfaces:
JacksonFeature
,java.io.Serializable
,java.lang.Comparable<JsonFactory.Feature>
- Enclosing class:
- JsonFactory
public static enum JsonFactory.Feature extends java.lang.Enum<JsonFactory.Feature> implements JacksonFeature
Enumeration that defines all on/off features that can only be changed forJsonFactory
.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CANONICALIZE_FIELD_NAMES
Feature that determines whether JSON object field names are to be canonicalized (details of how canonicalization is done then further specified byINTERN_FIELD_NAMES
).FAIL_ON_SYMBOL_HASH_OVERFLOW
Feature that determines what happens if we encounter a case in symbol handling where number of hash collisions exceeds a safety threshold -- which almost certainly means a denial-of-service attack via generated duplicate hash codes.INTERN_FIELD_NAMES
Feature that determines whether JSON object field names are to be canonicalized usingString.intern()
or not: if enabled, all field names will be intern()ed (and caller can count on this being true for all such names); if disabled, no intern()ing is done.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING
Feature that determines whether we will useBufferRecycler
withThreadLocal
andSoftReference
, for efficient reuse of underlying input/output buffers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
collectDefaults()
Method that calculates bit set (flags) of all features that are enabled by default.boolean
enabledByDefault()
Accessor for checking whether this feature is enabled by default.boolean
enabledIn(int flags)
Convenience method for checking whether feature is enabled in given bitmask.int
getMask()
Returns bit mask for this feature instance; must be a single bit, that is of form1 << N
.static JsonFactory.Feature
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static JsonFactory.Feature[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INTERN_FIELD_NAMES
public static final JsonFactory.Feature INTERN_FIELD_NAMES
Feature that determines whether JSON object field names are to be canonicalized usingString.intern()
or not: if enabled, all field names will be intern()ed (and caller can count on this being true for all such names); if disabled, no intern()ing is done. There may still be basic canonicalization (that is, same String will be used to represent all identical object property names for a single document).Note: this setting only has effect if
CANONICALIZE_FIELD_NAMES
is true -- otherwise no canonicalization of any sort is done.This setting is enabled by default.
-
CANONICALIZE_FIELD_NAMES
public static final JsonFactory.Feature CANONICALIZE_FIELD_NAMES
Feature that determines whether JSON object field names are to be canonicalized (details of how canonicalization is done then further specified byINTERN_FIELD_NAMES
).This setting is enabled by default.
-
FAIL_ON_SYMBOL_HASH_OVERFLOW
public static final JsonFactory.Feature FAIL_ON_SYMBOL_HASH_OVERFLOW
Feature that determines what happens if we encounter a case in symbol handling where number of hash collisions exceeds a safety threshold -- which almost certainly means a denial-of-service attack via generated duplicate hash codes. If feature is enabled, anIllegalStateException
is thrown to indicate the suspected denial-of-service attack; if disabled, processing continues but canonicalization (and therebyintern()
ing) is disabled) as protective measure.This setting is enabled by default.
- Since:
- 2.4
-
USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING
public static final JsonFactory.Feature USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING
Feature that determines whether we will useBufferRecycler
withThreadLocal
andSoftReference
, for efficient reuse of underlying input/output buffers. This usually makes sense on normal J2SE/J2EE server-side processing; but may not make sense on platforms whereSoftReference
handling is broken (like Android), or if there are retention issues due toThreadLocal
(see jackson-core#189 for a possible case)This setting is enabled by default.
- Since:
- 2.6
-
-
Method Detail
-
values
public static JsonFactory.Feature[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (JsonFactory.Feature c : JsonFactory.Feature.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static JsonFactory.Feature valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
collectDefaults
public static int collectDefaults()
Method that calculates bit set (flags) of all features that are enabled by default.- Returns:
- Bit field of features enabled by default
-
enabledByDefault
public boolean enabledByDefault()
Description copied from interface:JacksonFeature
Accessor for checking whether this feature is enabled by default.- Specified by:
enabledByDefault
in interfaceJacksonFeature
- Returns:
- Whether this instance is enabled by default or not
-
enabledIn
public boolean enabledIn(int flags)
Description copied from interface:JacksonFeature
Convenience method for checking whether feature is enabled in given bitmask.- Specified by:
enabledIn
in interfaceJacksonFeature
- Parameters:
flags
- Bit field that contains a set of enabled features of this type- Returns:
- True if this feature is enabled in passed bit field
-
getMask
public int getMask()
Description copied from interface:JacksonFeature
Returns bit mask for this feature instance; must be a single bit, that is of form1 << N
.- Specified by:
getMask
in interfaceJacksonFeature
- Returns:
- Bit mask of this feature
-
-