|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.lang.Closure
Represents any closure object in Groovy.
Nested Class Summary | |
private class |
Closure.WritableClosure
|
Field Summary | |
private java.lang.Object[] |
curriedParams
|
private java.lang.Object |
delegate
|
private int |
directive
|
private java.lang.reflect.Method |
doCallMethod
|
static int |
DONE
|
private static java.lang.Object[] |
emptyArray
|
private static java.lang.Object[] |
emptyArrayParameter
|
private static java.lang.Object[] |
noParameters
|
private int |
numberOfParameters
|
private java.lang.Object |
owner
|
private java.lang.Class[] |
parameterTypes
|
static int |
SKIP
|
private boolean |
supportsVarargs
|
Fields inherited from class groovy.lang.GroovyObjectSupport |
|
Constructor Summary | |
Closure(java.lang.Object delegate)
|
Method Summary | |
Closure |
asWritable()
|
java.lang.Object |
call()
Invokes the closure without any parameters, returning any value if applicable. |
java.lang.Object |
call(java.lang.Object arguments)
Invokes the closure, returning any value if applicable. |
private java.lang.Object |
callViaReflection(java.lang.Object[] params)
|
java.lang.Object |
clone()
|
Closure |
curry(java.lang.Object[] arguments)
Support for closure currying |
protected java.lang.Object |
doCall(java.lang.Object p1)
An attempt to optimise calling closures with one parameter If the closure has one untyped parameter then it will overload this function If not this will be called ans will use reflection to deal with the case of a single typed parameter |
protected java.lang.Object |
doCall(java.lang.Object p1,
java.lang.Object p2)
An attempt to optimise calling closures with two parameters If the closure has two untyped parameters then it will overload this function If not this will be called ans will use reflection to deal with the case of one or two typed parameters |
java.lang.Object |
getDelegate()
|
int |
getDirective()
|
java.lang.String |
getMethod()
Used when a closure wraps a method on a class |
java.lang.Object |
getOwner()
|
java.lang.Class[] |
getParameterTypes()
|
java.lang.Object |
getProperty(java.lang.String property)
|
java.lang.Object |
invokeMethod(java.lang.String method,
java.lang.Object arguments)
Invokes the given method |
void |
run()
|
void |
setDelegate(java.lang.Object delegate)
Allows the delegate to be changed such as when performing markup building |
void |
setDirective(int directive)
|
void |
setProperty(java.lang.String property,
java.lang.Object newValue)
Sets the given property to the new value |
protected static java.lang.Object |
throwRuntimeException(java.lang.Throwable throwable)
|
Methods inherited from class groovy.lang.GroovyObjectSupport |
getMetaClass, setMetaClass |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.Object[] noParameters
private static final java.lang.Object[] emptyArray
private static final java.lang.Object[] emptyArrayParameter
private java.lang.Object delegate
private final java.lang.Object owner
private final java.lang.reflect.Method doCallMethod
private final boolean supportsVarargs
private final java.lang.Class[] parameterTypes
private final int numberOfParameters
private java.lang.Object[] curriedParams
private int directive
public static int DONE
public static int SKIP
Constructor Detail |
public Closure(java.lang.Object delegate)
Method Detail |
public java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments)
GroovyObject
invokeMethod
in interface GroovyObject
invokeMethod
in class GroovyObjectSupport
public java.lang.Object getProperty(java.lang.String property)
getProperty
in interface GroovyObject
getProperty
in class GroovyObjectSupport
public void setProperty(java.lang.String property, java.lang.Object newValue)
GroovyObject
setProperty
in interface GroovyObject
setProperty
in class GroovyObjectSupport
public java.lang.Object call()
public java.lang.Object call(java.lang.Object arguments)
arguments
- could be a single value or a List of values
protected static java.lang.Object throwRuntimeException(java.lang.Throwable throwable)
protected java.lang.Object doCall(java.lang.Object p1)
p1
-
protected java.lang.Object doCall(java.lang.Object p1, java.lang.Object p2)
p1
-
private java.lang.Object callViaReflection(java.lang.Object[] params)
public java.lang.String getMethod()
public java.lang.Object getOwner()
public java.lang.Object getDelegate()
public void setDelegate(java.lang.Object delegate)
delegate
- public java.lang.Class[] getParameterTypes()
public Closure asWritable()
public void run()
run
in interface java.lang.Runnable
public Closure curry(java.lang.Object[] arguments)
arguments
- public java.lang.Object clone()
public int getDirective()
public void setDirective(int directive)
directive
- The directive to set.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |