public class ClosureUtils extends Object
Constructor and Description |
---|
ClosureUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
convertClosureToSource(ReaderSource readerSource,
ClosureExpression expression)
Converts a ClosureExpression into the String source.
|
static Parameter[] |
getParametersSafe(ClosureExpression ce) |
static boolean |
hasImplicitParameter(ClosureExpression ce) |
static boolean |
hasSingleCharacterArg(Closure c)
Does the Closure have a single char-like (char or Character) argument.
|
static boolean |
hasSingleStringArg(Closure c)
Does the Closure have a single String argument.
|
public static String convertClosureToSource(ReaderSource readerSource, ClosureExpression expression) throws Exception
readerSource
- a sourceexpression
- a closure. Can't be nullIllegalArgumentException
- when expression is nullException
- when closure can't be read from sourcepublic static boolean hasSingleCharacterArg(Closure c)
c
- a Closurepublic static boolean hasSingleStringArg(Closure c)
c
- a Closurepublic static boolean hasImplicitParameter(ClosureExpression ce)
public static Parameter[] getParametersSafe(ClosureExpression ce)