You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2019/09/03 15:38:02 UTC
[groovy] branch GROOVY-9240 updated: Added named param annotations
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch GROOVY-9240
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY-9240 by this push:
new 8c437f2 Added named param annotations
8c437f2 is described below
commit 8c437f26cfd9986d0d77c9c58931b89b4f02d5b9
Author: Eric Milles <er...@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);
}