com.fasterxml.jackson.annotation
Enum JsonTypeInfo.Id

java.lang.Object
  extended by java.lang.Enum<JsonTypeInfo.Id>
      extended by com.fasterxml.jackson.annotation.JsonTypeInfo.Id
All Implemented Interfaces:
Serializable, Comparable<JsonTypeInfo.Id>
Enclosing class:
JsonTypeInfo

public static enum JsonTypeInfo.Id
extends Enum<JsonTypeInfo.Id>

Definition of different type identifiers that can be included in JSON during serialization, and used for deserialization.


Enum Constant Summary
CLASS
          Means that fully-qualified Java class name is used as the type identifier.
CUSTOM
          Means that typing mechanism uses customized handling, with possibly custom configuration.
MINIMAL_CLASS
          Means that Java class name with minimal path is used as the type identifier.
NAME
          Means that logical type name is used as type information; name will then need to be separately resolved to actual concrete type (Class).
NONE
          This means that no explicit type metadata is included, and typing is purely done using contextual information possibly augmented with other annotations.
 
Method Summary
 String getDefaultPropertyName()
           
static JsonTypeInfo.Id valueOf(String name)
          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.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

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.


MINIMAL_CLASS

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).


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())
    System.out.println(c);

Returns:
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.)

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 name
NullPointerException - if the argument is null

getDefaultPropertyName

public String getDefaultPropertyName()


Copyright © 2012 FasterXML. All Rights Reserved.