org.codehaus.groovy.runtime
Class MethodClosure
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Closure
org.codehaus.groovy.runtime.MethodClosure
- All Implemented Interfaces:
- Cloneable, groovy.lang.GroovyObject, Runnable
- public class MethodClosure
- extends groovy.lang.Closure
Represents a method on an object using a closure which can be invoked
at any time
- Version:
- $Revision: 1.6 $
- Author:
- James Strachan
Fields inherited from class groovy.lang.Closure |
DONE, SKIP |
Method Summary |
Object |
call(Object arguments)
Invokes the closure, returning any value if applicable. |
protected Object |
doCall(Object arguments)
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 |
groovy.lang.MetaClass |
getMetaClass()
|
String |
getMethod()
Used when a closure wraps a method on a class |
void |
setMetaClass(groovy.lang.MetaClass metaClass)
Allows the MetaClass to be replaced with a derived implementation |
Methods inherited from class groovy.lang.Closure |
asWritable, call, clone, curry, doCall, getDelegate, getDirective, getOwner, getParameterTypes, getProperty, invokeMethod, run, setDelegate, setDirective, setProperty, throwRuntimeException |
MethodClosure
public MethodClosure(Object delegate)
MethodClosure
public MethodClosure(Object owner,
String method)
getMethod
public String getMethod()
- Description copied from class:
groovy.lang.Closure
- Used when a closure wraps a method on a class
- Returns:
- empty string
call
public Object call(Object arguments)
- Description copied from class:
groovy.lang.Closure
- Invokes the closure, returning any value if applicable.
- Parameters:
arguments
- could be a single value or a List of values
- Returns:
- the value if applicable or null if there is no return statement in the closure
getMetaClass
public groovy.lang.MetaClass getMetaClass()
setMetaClass
public void setMetaClass(groovy.lang.MetaClass metaClass)
- Description copied from interface:
groovy.lang.GroovyObject
- Allows the MetaClass to be replaced with a derived implementation
doCall
protected Object doCall(Object arguments)
- Description copied from class:
groovy.lang.Closure
- 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
- Parameters:
arguments
-
- Returns:
- the result of calling the closure
Copyright © 2003-2005 The Codehaus. All Rights Reserved.