Rewritting the archetype to be simpler and more easily modifiable to one's needs
3 import net.java.html.json.ComputedProperty;
4 import net.java.html.json.Function;
5 import net.java.html.json.Model;
6 import net.java.html.json.Property;
8 /** Model annotation generates class Data with
9 * one message property, boolean property and read only words property
11 @Model(className = "Data", properties = {
12 @Property(name = "message", type = String.class),
13 @Property(name = "on", type = boolean.class)
15 final class DataModel {
16 @ComputedProperty static java.util.List<String> words(String message) {
17 String[] arr = new String[6];
18 String[] words = message == null ? new String[0] : message.split(" ", 6);
19 for (int i = 0; i < 6; i++) {
20 arr[i] = words.length > i ? words[i] : "!";
22 return java.util.Arrays.asList(arr);
25 @Function static void turnOn(Data model) {
28 @Function static void turnOff(Data model) {