Package jakarta.json.bind.annotation
Annotation Interface JsonbTypeInfo
@JsonbAnnotation
@Retention(RUNTIME)
@Target({ANNOTATION_TYPE,TYPE})
public @interface JsonbTypeInfo
Configuration annotation of the type information handling.
This annotation is required on the most common parent of all classes when type information will be applied.
This annotation is required on the most common parent of all classes when type information will be applied.
// Example
@JsonbTypeInfo(key = "@key")
interface Animal {}
class Dog implements Animal {}
class Cat implements Animal {}
This annotation is tightly bound to JsonbSubtype
. It is required to use
JsonbSubtype
annotations to specify all the possible classes and their aliases.-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionKey used for keeping the type information (alias).Allowed aliases of the handled type. -
Field Summary
-
Field Details
-
DEFAULT_KEY_NAME
Default type information key name.- See Also:
-
-
Element Details
-
key
String keyKey used for keeping the type information (alias). Default value is@type
.- Returns:
- key name
- Default:
- "@type"
-
value
JsonbSubtype[] valueAllowed aliases of the handled type.- Returns:
- list of allowed aliases
- Default:
- {}
-