public static enum ObjectMapper.DefaultTyping extends Enum<ObjectMapper.DefaultTyping>
ObjectMapper.enableDefaultTyping()
to specify what kind of types (classes) default typing should
be used for. It will only be used if no explicit type information
is found, but this enumeration further limits subset of those types.
Since 2.4 there are special exceptions for JSON Tree model
types (sub-types of TreeNode
: default typing is never
applied to them.
Since 2.8(.4) additional checks are made to avoid attempts at default
typing primitive-valued properties.
NOTE: use of Default Typing can be a potential security risk if incoming
content comes from untrusted sources, and it is recommended that this
is either not done, or, if enabled, use ObjectMapper.setDefaultTyping(com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder<?>)
passing a custom TypeResolverBuilder
implementation that white-lists
legal types to use.
Enum Constant and Description |
---|
JAVA_LANG_OBJECT
This value means that only properties that have
Object as declared type (including
generic types without explicit type) will use default
typing. |
NON_CONCRETE_AND_ARRAYS
Value that means that default typing will be used for
all types covered by
OBJECT_AND_NON_CONCRETE
plus all array types for them. |
NON_FINAL
Value that means that default typing will be used for
all non-final types, with exception of small number of
"natural" types (String, Boolean, Integer, Double), which
can be correctly inferred from JSON; as well as for
all arrays of non-final types.
|
OBJECT_AND_NON_CONCRETE
Value that means that default typing will be used for
properties with declared type of
Object
or an abstract type (abstract class or interface). |
Modifier and Type | Method and Description |
---|---|
static ObjectMapper.DefaultTyping |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ObjectMapper.DefaultTyping[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ObjectMapper.DefaultTyping JAVA_LANG_OBJECT
Object
as declared type (including
generic types without explicit type) will use default
typing.public static final ObjectMapper.DefaultTyping OBJECT_AND_NON_CONCRETE
public static final ObjectMapper.DefaultTyping NON_CONCRETE_AND_ARRAYS
OBJECT_AND_NON_CONCRETE
plus all array types for them.
Since 2.4, this does NOT apply to TreeNode
and its subtypes.
public static final ObjectMapper.DefaultTyping NON_FINAL
Since 2.4, this does NOT apply to TreeNode
and its subtypes.
public static ObjectMapper.DefaultTyping[] values()
for (ObjectMapper.DefaultTyping c : ObjectMapper.DefaultTyping.values()) System.out.println(c);
public static ObjectMapper.DefaultTyping valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2008–2018 FasterXML. All rights reserved.