diff options
author | Tatu Saloranta <tatu.saloranta@iki.fi> | 2020-07-10 20:45:04 -0700 |
---|---|---|
committer | Tatu Saloranta <tatu.saloranta@iki.fi> | 2020-07-10 20:45:04 -0700 |
commit | dfe4a15073b4e5547857bbd05844e7c061e0d332 (patch) | |
tree | c30e05da97f311fd66b5a9d31e35ffa00a2005f9 | |
parent | d5ebec156ea8abecdc15d1afe5725ba58ac1378c (diff) | |
download | jackson-annotations-dfe4a15073b4e5547857bbd05844e7c061e0d332.tar.gz |
Backported #171
-rw-r--r-- | release-notes/VERSION-2.x | 2 | ||||
-rw-r--r-- | src/main/java/com/fasterxml/jackson/annotation/JsonSubTypes.java | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index e6b77b8..6eadd18 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -13,6 +13,8 @@ NOTE: Annotations module will never contain changes in patch versions, 2.12.0 (not yet released) +#171: `JsonSubType.Type` should accept array of names + (contributed by Swayam R) #173: Jackson version alignment with Gradle 6 2.11.0 (26-Apr-2020) diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonSubTypes.java b/src/main/java/com/fasterxml/jackson/annotation/JsonSubTypes.java index 8263038..9771bba 100644 --- a/src/main/java/com/fasterxml/jackson/annotation/JsonSubTypes.java +++ b/src/main/java/com/fasterxml/jackson/annotation/JsonSubTypes.java @@ -28,9 +28,9 @@ public @interface JsonSubTypes { public Type[] value(); /** - * Definition of a subtype, along with optional name. If name is missing, class - * of the type will be checked for {@link JsonTypeName} annotation; and if that - * is also missing or empty, a default + * 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 {@link 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. */ @@ -41,8 +41,17 @@ public @interface JsonSubTypes { public Class<?> value(); /** - * Logical type name used as the type identifier for the class + * Logical type name used as the type identifier for the class, if defined; empty + * String means "not defined". Used unless {@link #names} is defined as non-empty. */ public String name() default ""; + + /** + * (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 + */ + public String[] names() default {}; } } |