groovy.lang
Class Closure

java.lang.Object
  |
  +--groovy.lang.GroovyObjectSupport
        |
        +--groovy.lang.Closure
All Implemented Interfaces:
GroovyObject
Direct Known Subclasses:
IteratorClosureAdapter, MethodClosure

public abstract class Closure
extends GroovyObjectSupport

Represents any closure object in Groovy.

Version:
$Revision: 1.5 $
Author:
James Strachan

Constructor Summary
Closure(Object delegate)
           
 
Method Summary
 Object call()
          Invokes the closure without any parameters, returning any value if applicable.
 Object call(Object arguments)
          Invokes the closure, returning any value if applicable.
 Object getDelegate()
           
 Object invokeMethod(String method, Object arguments)
          Invokes the given method
 void setDelegate(Object delegate)
          Allows the delegate to be changed such as when performing markup building
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Closure

public Closure(Object delegate)
Method Detail

invokeMethod

public Object invokeMethod(String method,
                           Object arguments)
Description copied from interface: GroovyObject
Invokes the given method

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

call

public Object call()
Invokes the closure without any parameters, returning any value if applicable.

Returns:
the value if applicable or null if there is no return statement in the closure

call

public Object call(Object arguments)
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

getDelegate

public Object getDelegate()
Returns:
the delegate Object to which method calls will go which is typically the outer class when the closure is constructed

setDelegate

public void setDelegate(Object delegate)
Allows the delegate to be changed such as when performing markup building

Parameters:
delegate -


Copyright © 2003 The Codehaus. All Rights Reserved.