Enum JsonTypeInfo.Id

    • Enum Constant Detail

      • NONE

        public static final JsonTypeInfo.Id NONE
        This means that no explicit type metadata is included, and typing is purely done using contextual information possibly augmented with other annotations.
      • CLASS

        public static final JsonTypeInfo.Id CLASS
        Means that fully-qualified Java class name is used as the type identifier.

        public static final JsonTypeInfo.Id 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

        public static final JsonTypeInfo.Id NAME
        Means that logical type name is used as type information; name will then need to be separately resolved to actual concrete type (Class).

        public static final JsonTypeInfo.Id 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 properties visible, property and include are ignored.
      • CUSTOM

        public static final JsonTypeInfo.Id 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.
    • Method Detail

      • values

        public static JsonTypeInfo.Id[] 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 (JsonTypeInfo.Id c : JsonTypeInfo.Id.values())
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JsonTypeInfo.Id valueOf​(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.)
        name - the name of the enum constant to be returned.
        the enum constant with the specified name
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getDefaultPropertyName

        public String getDefaultPropertyName()