groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] 03/08: Added named param annotations
Date Tue, 17 Sep 2019 09:20:33 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 74268ea5ebd6dfd81720c48cc0e585f1f511d176
Author: Eric Milles <eric.milles@thomsonreuters.com>
AuthorDate: Tue Sep 3 10:37:56 2019 -0500

    Added named param annotations
---
 .../groovy/runtime/ResourceGroovyMethods.java      | 37 +++++++++++++++++++---
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
index 335086a..a77627a 100644
--- a/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
@@ -25,6 +25,7 @@ import groovy.io.GroovyPrintWriter;
 import groovy.lang.Closure;
 import groovy.lang.MetaClass;
 import groovy.lang.Writable;
+import groovy.transform.NamedParam;
 import groovy.transform.stc.ClosureParams;
 import groovy.transform.stc.FromString;
 import groovy.transform.stc.PickFirstResolver;
@@ -1308,8 +1309,23 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport
{
      * @see groovy.io.FileType
      * @since 1.7.1
      */
-    public static void traverse(final File self, final Map<String, ?> options, @ClosureParams(value
= SimpleType.class, options = "java.io.File") final Closure closure)
-            throws FileNotFoundException, IllegalArgumentException {
+    public static void traverse(final File self,
+            @NamedParam(value = "type", type = FileType.class)
+            @NamedParam(value = "preDir", type = Closure.class)
+            @NamedParam(value = "preRoot", type = Boolean.class)
+            @NamedParam(value = "postDir", type = Closure.class)
+            @NamedParam(value = "postRoot", type = Boolean.class)
+            @NamedParam(value = "visitRoot", type = Boolean.class)
+            @NamedParam(value = "maxDepth", type = Integer.class)
+            @NamedParam(value = "filter", type = Object.class)
+            @NamedParam(value = "nameFilter", type = Object.class)
+            @NamedParam(value = "excludeFilter", type = Object.class)
+            @NamedParam(value = "excludeNameFilter", type = Object.class)
+            @NamedParam(value = "sort", type = Closure.class)
+            final Map<String, ?> options,
+            @ClosureParams(value = SimpleType.class, options = "java.io.File")
+            final Closure closure)
+                throws FileNotFoundException, IllegalArgumentException {
         final int maxDepth;
         final boolean preRoot;
         final boolean postRoot;
@@ -1415,8 +1431,21 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport
{
      * @see #traverse(java.io.File, java.util.Map, groovy.lang.Closure)
      * @since 1.7.1
      */
-    public static void traverse(final File self, final Map<String, ?> options)
-            throws FileNotFoundException, IllegalArgumentException {
+    public static void traverse(final File self,
+            @NamedParam(value = "type", type = FileType.class)
+            @NamedParam(value = "preDir", type = Closure.class)
+            @NamedParam(value = "preRoot", type = Boolean.class)
+            @NamedParam(value = "postDir", type = Closure.class)
+            @NamedParam(value = "postRoot", type = Boolean.class)
+            @NamedParam(value = "visitRoot", type = Boolean.class)
+            @NamedParam(value = "maxDepth", type = Integer.class)
+            @NamedParam(value = "filter", type = Object.class)
+            @NamedParam(value = "nameFilter", type = Object.class)
+            @NamedParam(value = "excludeFilter", type = Object.class)
+            @NamedParam(value = "excludeNameFilter", type = Object.class)
+            @NamedParam(value = "sort", type = Closure.class)
+            final Map<String, ?> options)
+                throws FileNotFoundException, IllegalArgumentException {
         final Closure visit = (Closure) options.remove("visit");
         traverse(self, options, visit);
     }


Mime
View raw message