Package com.fasterxml.jackson.annotation
Enum JsonTypeInfo.Id
- All Implemented Interfaces:
Serializable
,Comparable<JsonTypeInfo.Id>
,java.lang.constant.Constable
- Enclosing class:
JsonTypeInfo
Definition of different type identifiers that can be included in JSON
during serialization, and used for deserialization.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionMeans that fully-qualified Java class name is used as the type identifier.Means that typing mechanism uses customized handling, with possibly custom configuration.Means that no serialized typing-property is used.Means that Java class name with minimal path is used as the type identifier.Means that logical type name is used as type information; name will then need to be separately resolved to actual concrete type (Class).This means that no explicit type metadata is included, and typing is purely done using contextual information possibly augmented with other annotations.Means that the simple name of the Java class, equivalent to the value returned byClass.getSimpleName()
, is used as the default type identifier, unless explicit name is specified by annotationJsonTypeName
. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonTypeInfo.Id
Returns the enum constant of this type with the specified name.static JsonTypeInfo.Id[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NONE
This means that no explicit type metadata is included, and typing is purely done using contextual information possibly augmented with other annotations. -
CLASS
Means that fully-qualified Java class name is used as the type identifier. -
MINIMAL_CLASS
Means that Java class name with minimal path is used as the type identifier. Minimal means that only the class name, and that part of preceding Java package name is included that is needed to construct fully-qualified name given fully-qualified name of the declared supertype; additionally a single leading dot ('.') must be used to indicate that partial class name is used. For example, for supertype "com.foobar.Base", and concrete type "com.foo.Impl", only ".Impl" would be included; and for "com.foo.impl.Impl2" only ".impl.Impl2" would be included.
NOTE: leading dot ('.') MUST be used to denote partial (minimal) name; if it is missing, value is assumed to be fully-qualified name. Fully-qualified name is used in cases where subtypes are not in same package (or sub-package thereof) as base class.If all related classes are in the same Java package, this option can reduce amount of type information overhead, especially for small types. However, please note that using this alternative is inherently risky since it assumes that the supertype can be reliably detected. Given that it is based on declared type (since ultimate supertype,
java.lang.Object
would not be very useful reference point), this may not always work as expected. -
NAME
Means that logical type name is used as type information; name will then need to be separately resolved to actual concrete type (Class). -
SIMPLE_NAME
Means that the simple name of the Java class, equivalent to the value returned byClass.getSimpleName()
, is used as the default type identifier, unless explicit name is specified by annotationJsonTypeName
.
For instance:- For a class "com.example.MyClass", only "MyClass" is used.
- For an inner class "com.example.MyClass$Inner", only "Inner" is used.
- Since:
- 2.16
-
DEDUCTION
Means that no serialized typing-property is used. Types are deduced based on the fields available. Deduction is limited to the names of fields (not their values or, consequently, any nested descendants). Exceptions will be thrown if not enough unique information is present to select a single subtype.
If deduction is being used annotation propertiesvisible
,property
andinclude
are ignored.On serialization, no type ID is written, and only regular properties are included.
- Since:
- 2.12
-
CUSTOM
Means that typing mechanism uses customized handling, with possibly custom configuration. This means that semantics of other properties is not defined by Jackson package, but by the custom implementation.
-
-
Field Details
-
_defaultPropertyName
-
-
Constructor Details
-
Id
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getDefaultPropertyName
-