1.1 --- a/json/src/main/java/org/apidesign/html/json/spi/Proto.java Tue Dec 24 13:43:31 2013 +0100
1.2 +++ b/json/src/main/java/org/apidesign/html/json/spi/Proto.java Thu Dec 26 22:42:01 2013 +0100
1.3 @@ -109,6 +109,13 @@
1.4 }
1.5 }
1.6
1.7 + public void extract(Object json, String[] props, Object[] values) {
1.8 + JSON.extract(context, json, props, values);
1.9 + }
1.10 +
1.11 + public <T> T read(Class<T> modelClass, Object data) {
1.12 + return JSON.read(context, modelClass, data);
1.13 + }
1.14
1.15 // XXX: Don't expose internal type
1.16 public Bindings initBindings() {
2.1 --- a/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java Tue Dec 24 13:43:31 2013 +0100
2.2 +++ b/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java Thu Dec 26 22:42:01 2013 +0100
2.3 @@ -386,7 +386,7 @@
2.4 values++;
2.5 }
2.6 w.append(" Object[] ret = new Object[" + values + "];\n");
2.7 - w.append(" org.netbeans.html.json.impl.JSON.extract(proto.getContext(), json, new String[] {\n");
2.8 + w.append(" proto.extract(json, new String[] {\n");
2.9 for (int i = 0; i < propsGetSet.size(); i += 5) {
2.10 Prprt p = findPrprt(props, propsGetSet.get(i));
2.11 if (p == null) {
2.12 @@ -409,8 +409,8 @@
2.13 w.append(" if (ret[" + cnt + "] instanceof Object[]) {\n");
2.14 w.append(" for (Object e : ((Object[])ret[" + cnt + "])) {\n");
2.15 if (isModel[0]) {
2.16 - w.append(" this.prop_").append(pn).append(".add(org.netbeans.html.json.impl.JSON.read");
2.17 - w.append("(c, " + type + ".class, e));\n");
2.18 + w.append(" this.prop_").append(pn).append(".add(proto.read");
2.19 + w.append("(" + type + ".class, e));\n");
2.20 } else if (isEnum[0]) {
2.21 w.append(" this.prop_").append(pn);
2.22 w.append(".add(e == null ? null : ");
2.23 @@ -448,8 +448,8 @@
2.24 w.append("ret[" + cnt + "])).");
2.25 w.append(type).append("Value();\n");
2.26 } else if (isModel[0]) {
2.27 - w.append(" this.prop_").append(pn).append(" = org.netbeans.html.json.impl.JSON.read");
2.28 - w.append("(c, " + type + ".class, ");
2.29 + w.append(" this.prop_").append(pn).append(" = proto.read");
2.30 + w.append("(" + type + ".class, ");
2.31 w.append("ret[" + cnt + "]);\n");
2.32 }else {
2.33 w.append(" this.prop_").append(pn);