Package org.graylog2.jackson
Annotation Interface JsonSubTypePropertyDefaultValue
An annotation that can be used to set a default logical type name for documents that are missing it.
This can be useful to set a default type for old JSON documents when migrating data structures from an
untyped to a typed version.
Example:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type")
@JsonSubTypes(@JsonSubTypes.Type(value = SubTypeA.class, name = "a"))
@JsonSubTypePropertyDefaultValue("a")
public @interface TestInterface {
}
The difference to the defaultImpl
parameter for JsonTypeInfo
is,
that the default value is only used when the type attribute is missing in a document. Using defaultImpl
will use the given default implementation in all cases, even if a document contains a non-existent type name.-
Required Element Summary
-
Element Details
-
value
String value
-