Documenting the batch initialization interface
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 07 Oct 2013 13:29:07 +0200
changeset 3089b48d4e57fa7
parent 304 3e5e3c96f9f1
child 309 7025177bd67e
Documenting the batch initialization interface
json/src/main/java/org/apidesign/html/json/spi/Technology.java
     1.1 --- a/json/src/main/java/org/apidesign/html/json/spi/Technology.java	Tue Sep 17 12:20:31 2013 +0200
     1.2 +++ b/json/src/main/java/org/apidesign/html/json/spi/Technology.java	Mon Oct 07 13:29:07 2013 +0200
     1.3 @@ -21,6 +21,7 @@
     1.4  package org.apidesign.html.json.spi;
     1.5  
     1.6  import net.java.html.json.Model;
     1.7 +import net.java.html.json.Models;
     1.8  
     1.9  /** An implementation of a binding between model classes (see {@link Model})
    1.10   * and particular technology like <a href="http://knockoutjs.com">knockout.js</a>
    1.11 @@ -88,7 +89,27 @@
    1.12       */
    1.13      public void runSafe(Runnable r);
    1.14  
    1.15 +    /** For certain rendering technologies it may be more efficient to register
    1.16 +     * property and function bindings for one instance of the model at once, 
    1.17 +     * rather then doing it incrementally via 
    1.18 +     * {@link Technology#expose(org.apidesign.html.json.spi.FunctionBinding, java.lang.Object, java.lang.Object) }
    1.19 +     * and 
    1.20 +     * {@link Technology#bind(org.apidesign.html.json.spi.PropertyBinding, java.lang.Object, java.lang.Object) }.
    1.21 +     * In such case implement the {@link #wrapModel(java.lang.Object, org.apidesign.html.json.spi.PropertyBinding[], org.apidesign.html.json.spi.FunctionBinding[]) }
    1.22 +     * method of this interface and it will be called instead of the 
    1.23 +     * previous two ones.
    1.24 +     * 
    1.25 +     * @@since 0.6
    1.26 +     */
    1.27      public static interface BatchInit<D> extends Technology<D> {
    1.28 +        /** Wrap the given model into redering technology appropriate object 
    1.29 +         * <code>D</code> and expose given properties and functions on it.
    1.30 +         * 
    1.31 +         * @param model the {@link Models#isModel(java.lang.Class) model} in Java
    1.32 +         * @param propArr array of property bindings to expose
    1.33 +         * @param funcArr array of functions to expose
    1.34 +         * @return appropriate wrapper around the model
    1.35 +         */
    1.36          public D wrapModel(Object model, PropertyBinding[] propArr, FunctionBinding[] funcArr);
    1.37      }
    1.38  }