Top Description Inners Methods
com.fasterxml.jackson.annotation

public @Interface JsonSubTypes

extends Annotation
Annotations
@Target:ANNOTATION_TYPE, TYPE, FIELD, METHOD, PARAMETER
@Retention:RUNTIME
@JacksonAnnotation
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

Annotation used with JsonTypeInfo to indicate subtypes of serializable polymorphic types, and to associate logical names used within JSON content (which is more portable than using physical Java class names).

Note that just annotating a property or base type with this annotation does NOT enable polymorphic type handling: in addition, JsonTypeInfo or equivalent (such as enabling of so-called "default typing") annotation is needed, and only in such case is subtype information used.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static @interface
JsonSubTypes.Type

Definition of a subtype, along with optional name(s).

Method Summary

Modifier and TypeMethod and Description
public boolean
failOnRepeatedNames()

Subtypes of the annotated type may have logical type name and names properties.

public JsonSubTypes.Type[]
value()

Subtypes of the annotated type (annotated class, or property value type associated with the annotated method).

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

failOnRepeatedNamesback to summary
public boolean failOnRepeatedNames()

Subtypes of the annotated type may have logical type name and names properties. When set to true, logical type name and names are going to be checked for repeated values. Repeated values are considered a definition violation during that check.

Since
2.14
valueback to summary
public JsonSubTypes.Type[] value()

Subtypes of the annotated type (annotated class, or property value type associated with the annotated method). These will be checked recursively so that types can be defined by only including direct subtypes.

com.fasterxml.jackson.annotation back to summary

public @Interface JsonSubTypes.Type

extends Annotation

Definition of a subtype, along with optional name(s). If no name is defined (empty Strings are ignored), class of the type will be checked for JsonTypeName annotation; and if that is also missing or empty, a default name will be constructed by type id mechanism. Default name is usually based on class name.

Method Summary

Modifier and TypeMethod and Description
public String
name()

Logical type name used as the type identifier for the class, if defined; empty String means "not defined".

public String[]
names()

(optional) Logical type names used as the type identifier for the class: used if more than one type name should be associated with the same type.

public Class<?>
value()

Class of the subtype

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

nameback to summary
public String name()

Logical type name used as the type identifier for the class, if defined; empty String means "not defined". Used unless names is defined as non-empty.

namesback to summary
public String[] names()

(optional) Logical type names used as the type identifier for the class: used if more than one type name should be associated with the same type.

Since
2.12
valueback to summary
public Class<?> value()

Class of the subtype