com.fasterxml.jackson.annotation
Enum JsonTypeInfo.As

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

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

Definition of standard type inclusion mechanisms for type metadata. Used for standard metadata types, except for JsonTypeInfo.Id.NONE. May or may not be used for custom types (JsonTypeInfo.Id.CUSTOM).


Enum Constant Summary
EXTERNAL_PROPERTY
          Inclusion mechanism similar to PROPERTY, except that property is included one-level higher in hierarchy, i.e.
PROPERTY
          Inclusion mechanism that uses a single configurable property, included along with actual data (POJO properties) as a separate meta-property.
WRAPPER_ARRAY
          Inclusion mechanism that wraps typed JSON value (POJO serialized as JSON) in a 2-element JSON array: first element is the serialized type identifier, and second element the serialized POJO as JSON Object.
WRAPPER_OBJECT
          Inclusion mechanism that wraps typed JSON value (POJO serialized as JSON) in a JSON Object that has a single entry, where field name is serialized type identifier, and value is the actual JSON value.
 
Method Summary
static JsonTypeInfo.As valueOf(String name)
          Returns the enum constant of this type with the specified name.
static JsonTypeInfo.As[] 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

PROPERTY

public static final JsonTypeInfo.As PROPERTY
Inclusion mechanism that uses a single configurable property, included along with actual data (POJO properties) as a separate meta-property.

Default choice for inclusion.


WRAPPER_OBJECT

public static final JsonTypeInfo.As WRAPPER_OBJECT
Inclusion mechanism that wraps typed JSON value (POJO serialized as JSON) in a JSON Object that has a single entry, where field name is serialized type identifier, and value is the actual JSON value.

Note: can only be used if type information can be serialized as String. This is true for standard type metadata types, but not necessarily for custom types.


WRAPPER_ARRAY

public static final JsonTypeInfo.As WRAPPER_ARRAY
Inclusion mechanism that wraps typed JSON value (POJO serialized as JSON) in a 2-element JSON array: first element is the serialized type identifier, and second element the serialized POJO as JSON Object.


EXTERNAL_PROPERTY

public static final JsonTypeInfo.As EXTERNAL_PROPERTY
Inclusion mechanism similar to PROPERTY, except that property is included one-level higher in hierarchy, i.e. as sibling property at same level as JSON Object to type. Note that this choice can only be used for properties, not for types (classes). Trying to use it for classes will result in inclusion strategy of basic PROPERTY instead.

Method Detail

values

public static JsonTypeInfo.As[] 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.As c : JsonTypeInfo.As.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.As 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


Copyright © 2012 fasterxml.com. All Rights Reserved.