Proper Javadoc for Bck2Brwsr Native annotations
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 28 Feb 2013 20:51:53 +0100
changeset 793033ea09379a0
parent 792 0b32ef894ba6
child 794 b4284da2fb3b
Proper Javadoc for Bck2Brwsr Native annotations
pom.xml
rt/core/pom.xml
rt/core/src/main/java/org/apidesign/bck2brwsr/core/ExtraJavaScript.java
rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java
rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptOnly.java
rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptPrototype.java
     1.1 --- a/pom.xml	Thu Feb 28 13:00:24 2013 +0100
     1.2 +++ b/pom.xml	Thu Feb 28 20:51:53 2013 +0100
     1.3 @@ -94,6 +94,11 @@
     1.4                  <artifactId>maven-surefire-plugin</artifactId>
     1.5                  <version>2.13</version>
     1.6                </plugin>
     1.7 +              <plugin>
     1.8 +                <groupId>org.apache.maven.plugins</groupId>
     1.9 +                <artifactId>maven-javadoc-plugin</artifactId>
    1.10 +                <version>2.9</version>
    1.11 +              </plugin>
    1.12            </plugins>
    1.13        </pluginManagement>
    1.14    </build>
     2.1 --- a/rt/core/pom.xml	Thu Feb 28 13:00:24 2013 +0100
     2.2 +++ b/rt/core/pom.xml	Thu Feb 28 20:51:53 2013 +0100
     2.3 @@ -23,6 +23,13 @@
     2.4                      <target>1.7</target>
     2.5                  </configuration>
     2.6              </plugin>
     2.7 +            <plugin>
     2.8 +                <groupId>org.apache.maven.plugins</groupId>
     2.9 +                <artifactId>maven-javadoc-plugin</artifactId>
    2.10 +                <configuration>
    2.11 +                    <excludePackageNames>org.apidesign.bck2brwsr.core.impl</excludePackageNames>
    2.12 +                </configuration>
    2.13 +            </plugin>
    2.14          </plugins>
    2.15      </build>
    2.16      <properties>
     3.1 --- a/rt/core/src/main/java/org/apidesign/bck2brwsr/core/ExtraJavaScript.java	Thu Feb 28 13:00:24 2013 +0100
     3.2 +++ b/rt/core/src/main/java/org/apidesign/bck2brwsr/core/ExtraJavaScript.java	Thu Feb 28 20:51:53 2013 +0100
     3.3 @@ -22,14 +22,16 @@
     3.4  import java.lang.annotation.RetentionPolicy;
     3.5  import java.lang.annotation.Target;
     3.6  
     3.7 -/**
     3.8 +/** A way to include pre-made JavaScript scripts and libraries.
     3.9 + * The {@link #resource()} is loaded into the JavaScript VM and its object
    3.10 + * can be referenced from the class annotated by this annotation.
    3.11   *
    3.12   * @author Jaroslav Tulach <jtulach@netbeans.org>
    3.13   */
    3.14  @Retention(RetentionPolicy.CLASS)
    3.15  @Target(ElementType.TYPE)
    3.16  public @interface ExtraJavaScript {
    3.17 -    /** location of a script to load */
    3.18 +    /** fully qualified location of a script to load. Start the path with slash. */
    3.19      String resource();
    3.20      /** should the class file still be processed or not? */
    3.21      boolean processByteCode() default true;
     4.1 --- a/rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java	Thu Feb 28 13:00:24 2013 +0100
     4.2 +++ b/rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptBody.java	Thu Feb 28 20:51:53 2013 +0100
     4.3 @@ -22,22 +22,17 @@
     4.4  import java.lang.annotation.RetentionPolicy;
     4.5  import java.lang.annotation.Target;
     4.6  
     4.7 -/** Put this method on a method in case it should have a special
     4.8 - * body in the <em>JavaScript</em>.
     4.9 +/** Put this annotation on a method to provide its special implementation
    4.10 + * in JavaScript. This is a way to define <em>native</em> methods that 
    4.11 + * interact with the surrounding environment.
    4.12   *
    4.13   * @author Jaroslav Tulach <jtulach@netbeans.org>
    4.14   */
    4.15  @Retention(RetentionPolicy.CLASS)
    4.16  @Target({ ElementType.METHOD, ElementType.CONSTRUCTOR })
    4.17  public @interface JavaScriptBody {
    4.18 -    /** Names of parameters for the method. 
    4.19 -     * 
    4.20 -     * <!--
    4.21 -     * If not specified
    4.22 -     * it will be <code>arg0, arg1, arg2</code>. In case of
    4.23 -     * instance methods, the <code>arg0</code> is reference
    4.24 -     * to <code>this</code>.
    4.25 -     * -->
    4.26 +    /** Names of parameters for the method generated method that can
    4.27 +     * be referenced from {@link #body()}.
    4.28       * 
    4.29       * @return array of the names of parameters for the method
    4.30       *    in JavaScript
    4.31 @@ -46,6 +41,12 @@
    4.32      
    4.33      /** The actual body of the method in JavaScript. This string will be
    4.34       * put into generated header (ends with '{') and footer (ends with '}').
    4.35 +     * The body can reference provided arguments. In case of non-static
    4.36 +     * instance method it may reference <code>this</code>. It can also 
    4.37 +     * call methods and access fields - if 
    4.38 +     * <a href="http://wiki.apidesign.org/wiki/Bck2BrwsrMangling">proper mangling</a> 
    4.39 +     * is used. Methods that return some value should end with <code>return</code> 
    4.40 +     * statement.
    4.41       */
    4.42      public String body();
    4.43  }
     5.1 --- a/rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptOnly.java	Thu Feb 28 13:00:24 2013 +0100
     5.2 +++ b/rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptOnly.java	Thu Feb 28 20:51:53 2013 +0100
     5.3 @@ -22,16 +22,17 @@
     5.4  import java.lang.annotation.RetentionPolicy;
     5.5  import java.lang.annotation.Target;
     5.6  
     5.7 -/** Don't include given field or method in generated JavaScript. Rather
     5.8 - * generate completely independent JavaScript code.
     5.9 +/** Don't include given method in the generated JavaScript at all. Rather
    5.10 + * generate completely independent JavaScript code consisting of
    5.11 + * <code>"{@link #name()}" = "{@link #value()}"</code>.
    5.12   *
    5.13   * @author Jaroslav Tulach <jtulach@netbeans.org>
    5.14   */
    5.15  @Retention(RetentionPolicy.CLASS)
    5.16 -@Target({ ElementType.METHOD, ElementType.FIELD })
    5.17 +@Target({ ElementType.METHOD })
    5.18  public @interface JavaScriptOnly {
    5.19      /** name of the variable to assign given value to */
    5.20      String name() default "";
    5.21 -    /** value to assign to given field */
    5.22 +    /** value to assign to the {@link #name()} variable */
    5.23      String value() default "";
    5.24  }
     6.1 --- a/rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptPrototype.java	Thu Feb 28 13:00:24 2013 +0100
     6.2 +++ b/rt/core/src/main/java/org/apidesign/bck2brwsr/core/JavaScriptPrototype.java	Thu Feb 28 20:51:53 2013 +0100
     6.3 @@ -22,7 +22,14 @@
     6.4  import java.lang.annotation.RetentionPolicy;
     6.5  import java.lang.annotation.Target;
     6.6  
     6.7 -/** Controls how JavaScript inheritance should be handled.
     6.8 +/** Influence the inheritance of your class when converted to JavaScript.
     6.9 + * Sometimes one does not want
    6.10 + * to mimic the Java hierarchy, but modify it a bit. For example it makes
    6.11 + * sense to treat every (JavaScript) string literal as {@link String}.
    6.12 + * One can do it by making {@link String} subclass JavaScript <code>String</code>
    6.13 + * and use <code>String.prototype</code> as a container for all {@link String}
    6.14 + * methods.
    6.15 + * 
    6.16   * @author Jaroslav Tulach <jtulach@netbeans.org>
    6.17   */
    6.18  @Retention(RetentionPolicy.CLASS)