rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java
changeset 793 033ea09379a0
parent 772 d382dacfd73f
child 1787 ea12a3bb4b33
     1.1 --- a/rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java	Tue Feb 26 16:54:16 2013 +0100
     1.2 +++ b/rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java	Thu Feb 28 20:51:53 2013 +0100
     1.3 @@ -22,22 +22,17 @@
     1.4  import java.lang.annotation.RetentionPolicy;
     1.5  import java.lang.annotation.Target;
     1.6  
     1.7 -/** Put this method on a method in case it should have a special
     1.8 - * body in the <em>JavaScript</em>.
     1.9 +/** Put this annotation on a method to provide its special implementation
    1.10 + * in JavaScript. This is a way to define <em>native</em> methods that 
    1.11 + * interact with the surrounding environment.
    1.12   *
    1.13   * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.14   */
    1.15  @Retention(RetentionPolicy.CLASS)
    1.16  @Target({ ElementType.METHOD, ElementType.CONSTRUCTOR })
    1.17  public @interface JavaScriptBody {
    1.18 -    /** Names of parameters for the method. 
    1.19 -     * 
    1.20 -     * <!--
    1.21 -     * If not specified
    1.22 -     * it will be <code>arg0, arg1, arg2</code>. In case of
    1.23 -     * instance methods, the <code>arg0</code> is reference
    1.24 -     * to <code>this</code>.
    1.25 -     * -->
    1.26 +    /** Names of parameters for the method generated method that can
    1.27 +     * be referenced from {@link #body()}.
    1.28       * 
    1.29       * @return array of the names of parameters for the method
    1.30       *    in JavaScript
    1.31 @@ -46,6 +41,12 @@
    1.32      
    1.33      /** The actual body of the method in JavaScript. This string will be
    1.34       * put into generated header (ends with '{') and footer (ends with '}').
    1.35 +     * The body can reference provided arguments. In case of non-static
    1.36 +     * instance method it may reference <code>this</code>. It can also 
    1.37 +     * call methods and access fields - if 
    1.38 +     * <a href="http://wiki.apidesign.org/wiki/Bck2BrwsrMangling">proper mangling</a> 
    1.39 +     * is used. Methods that return some value should end with <code>return</code> 
    1.40 +     * statement.
    1.41       */
    1.42      public String body();
    1.43  }