You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by cc...@apache.org on 2015/10/07 21:16:57 UTC

[4/5] incubator-groovy git commit: Additions to @DelegatesTo javadoc

Additions to @DelegatesTo javadoc

Closes #134


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/50e422b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/50e422b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/50e422b8

Branch: refs/heads/master
Commit: 50e422b845493567b1be30ef61e99cd6104ec333
Parents: 020a942
Author: Shil S <sh...@gmail.com>
Authored: Tue Oct 6 18:20:27 2015 -0400
Committer: Cedric Champeau <cc...@apache.org>
Committed: Wed Oct 7 21:13:59 2015 +0200

----------------------------------------------------------------------
 src/main/groovy/lang/DelegatesTo.java | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/50e422b8/src/main/groovy/lang/DelegatesTo.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/DelegatesTo.java b/src/main/groovy/lang/DelegatesTo.java
index cb2f103..54a5e36 100644
--- a/src/main/groovy/lang/DelegatesTo.java
+++ b/src/main/groovy/lang/DelegatesTo.java
@@ -48,16 +48,30 @@ import java.lang.annotation.Target;
 @Target({ElementType.PARAMETER})
 public @interface DelegatesTo {
     Class value() default Target.class;
+
+    /**
+     * The {@link Closure#resolveStrategy} used by the closure.
+     */
     int strategy() default Closure.OWNER_FIRST;
+
+    /**
+     * The index of the generic type that will be the type of the closure's delegate.
+     * The generic types are considered with respect to the {@code @DelegatesTo.Target} annotated
+     * parameter for this usage, with the index starting at 0.
+     */
     int genericTypeIndex() default -1;
 
+    /**
+     * In cases when there are multiple {@code @DelegatesTo.Target} annotated parameters, this
+     * member should be set to the {@link DelegatesTo.Target#value()} of the correct target.
+     */
     String target() default "";
 
     /**
-     * The type member should be used when the type of the delagate cannot
+     * The type member should be used when the type of the delegate cannot
      * be represented with {@link #value()}, {@link #genericTypeIndex()} or
      * {@link #target()}. In this case, it is possible to use a String to represent
-     * the type, at the cost of potential uncatched errors at compile time if the
+     * the type, at the cost of potential uncaught errors at compile time if the
      * type is invalid and increased compile time.
      *
      * @return a String representation of a type
@@ -65,9 +79,18 @@ public @interface DelegatesTo {
      */
     String type() default "";
 
+    /**
+     * Parameter annotation used to specify the delegate for a {@code @DelegatesTo} annotated
+     * parameter of the same method.
+     */
     @Retention(RetentionPolicy.RUNTIME)
     @java.lang.annotation.Target({ElementType.PARAMETER})
     public static @interface Target {
-        String value() default ""; // optional id
+
+        /**
+         * An identifier that should be used to disambiguate targets when there are
+         * multiple {@code @DelegatesTo.Target} annotated parameters.
+         */
+        String value() default "";
     }
 }
\ No newline at end of file