org.codehaus.groovy.runtime
Class MethodClosure

java.lang.Object
  extended bygroovy.lang.GroovyObjectSupport
      extended bygroovy.lang.Closure
          extended byorg.codehaus.groovy.runtime.MethodClosure
All Implemented Interfaces:
java.lang.Cloneable, GroovyObject, java.lang.Runnable

public class MethodClosure
extends Closure

Represents a method on an object using a closure which can be invoked at any time

Version:
$Revision: 1.6 $
Author:
James Strachan

Constructor Summary
MethodClosure(java.lang.Object delegate)
           
MethodClosure(java.lang.Object owner, java.lang.String method)
           
 
Method Summary
 java.lang.Object call(java.lang.Object arguments)
          Invokes the closure, returning any value if applicable.
protected  java.lang.Object doCall(java.lang.Object arguments)
           
 MetaClass getMetaClass()
           
 java.lang.String getMethod()
           
 void setMetaClass(MetaClass metaClass)
          Allows the MetaClass to be replaced with a derived implementation
 
Methods inherited from class groovy.lang.Closure
asWritable, call, clone, curry, getDelegate, getDoCallMethod, getParameters, getParameterTypes, getProperty, invokeMethod, run, setDelegate, setProperty, throwRuntimeException
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodClosure

public MethodClosure(java.lang.Object delegate)

MethodClosure

public MethodClosure(java.lang.Object owner,
                     java.lang.String method)
Method Detail

getMethod

public java.lang.String getMethod()

call

public java.lang.Object call(java.lang.Object arguments)
Description copied from class: Closure
Invokes the closure, returning any value if applicable.

Overrides:
call in class Closure
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 MetaClass getMetaClass()
Specified by:
getMetaClass in interface GroovyObject
Overrides:
getMetaClass in class GroovyObjectSupport

setMetaClass

public void setMetaClass(MetaClass metaClass)
Description copied from interface: GroovyObject
Allows the MetaClass to be replaced with a derived implementation

Specified by:
setMetaClass in interface GroovyObject
Overrides:
setMetaClass in class GroovyObjectSupport

doCall

protected java.lang.Object doCall(java.lang.Object arguments)


Copyright © 2003-2004 The Codehaus. All Rights Reserved.