Annotation Type DataObject


  • @Retention(RUNTIME)
    @Target(TYPE)
    public @interface DataObject
    Declares a data object, such object must provide at least:
    • a constructor with io.vertx.core.json.JsonObject

    When the data object is processed, a model of properties from the setter methods or adder methods. Single valued and multi valued properties are supported.

    A setter is just like a JavaBean setter, however the method return type shall be fluent and return the current object. A 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 io.vertx.core.json.JsonArray type. An adder and a multi valued setter of the same property name are naturally compatible and is encouraged.

    Properties types can be:

    • any basic type
    • a valid data object type
    • io.vertx.core.json.JsonObject
    • io.vertx.core.json.JsonArray
    • an enum type
    • a List of above

    A data object can be an interface or an abstract class to accomodate the api design. Data object can extend other data objects.

    Sometimes data object can have a toJson() method that takes no arguments and returns a JsonObject representing the data object as a JsonObject.

    Author:
    Tim Fox