net.java.html.json
Annotation Type Model


@Retention(value=SOURCE)
@Target(value=TYPE)
public @interface Model

Defines a model class named className() which contains properties defined via properties(). This class can have methods annotated by ComputedProperty which define derived properties in the model class.

The generated class's toString converts the state of the object into JSON format.

An example where one defines class Person with three properties (firstName, lastName and fullName) follows:

 @Model(className="Person", properties={
   @Property(name = "firstName", type=String.class),
   @Property(name = "lastName", type=String.class)
 })
 static class PersonImpl {
   @ComputedProperty
   static String fullName(String firstName, String lastName) {
     return firstName + " " + lastName;
   }
 }
 

Author:
Jaroslav Tulach

Required Element Summary
 String className
          Name of the model class
 Property[] properties
          List of properties in the model.
 

Element Detail

className

public abstract String className
Name of the model class


properties

public abstract Property[] properties
List of properties in the model.



Copyright © 2013 API Design. All Rights Reserved.