@Retention(value=RUNTIME) @Target(value=TYPE) public @interface DataObject
JsonObject
List
setter type declares a multi valued property, otherwise it declares
a single valued property.
An adder is a method prefixed by add
, its purpose is to declare a List
of properties.
An adder declares a multi valued property, mapped to the JsonArray
type. An adder
and a multi valued setter of the same property name are naturally compatible and is encouraged.
Properties types can be:
JsonObject
JsonArray
List
of abovetoJson()
method that takes no arguments and returns a JsonObject
representing
the data object as a JsonObject
.
Vert.x core will generate a json converters using annotation processing to ease conversion, for a given data object,
a converter is generated, the name of this converter is the name of the data object with the Converter suffix.
The converter has a fromJson(JsonObject,T)
and a toJson(T,JsonObject)
public static methods, such methods
can be used by the json constructor or the toJson()
method to implement the conversion code. By default the
generated methods only handle the conversion of the property of the data object and do not handle the properties of the
ancestors of this data object, inheritConverter()
can be set to true to change this behavior and handle the
conversion of the inherited properties as well. The converter generation can be prevented with the
generateConverter()
annotation member.Modifier and Type | Optional Element and Description |
---|---|
boolean |
generateConverter |
boolean |
inheritConverter |
boolean |
publicConverter |
public abstract boolean generateConverter
Copyright © 2017. All rights reserved.