Skip to content
JonathanO edited this page Feb 10, 2013 · 2 revisions

JsonSubTypes

Specify a list of classes which extend this class, and optionally their "names". Used for handling inheritance (see @JsonTypeInfo)

This can also be used on a property/getter/setter to provide information about subtypes of the type of that particular field.

Parameters

  1. value (JsonSubTypes\Type[]) The sub types

JsonSubTypes\Type

  1. value (string) The sub class
  2. name (string) An optional name for use if names are needed, and JsonTypeName isn't being used.

Examples

<?
/**
 * @JsonSubTypes({@JsonSubTypes\Type("Foo"), @JsonSubTypes\Type("Bar")})
 */
class Baz {
}

class Foo extends Baz {
}

class Bar extends Baz {
}

Back to Annotations list

Clone this wiki locally