groovy.lang
Class Closure.WritableClosure

java.lang.Object
  extended bygroovy.lang.GroovyObjectSupport
      extended bygroovy.lang.Closure
          extended bygroovy.lang.Closure.WritableClosure
All Implemented Interfaces:
java.lang.Cloneable, GroovyObject, java.lang.Runnable, Writable
Enclosing class:
Closure

private class Closure.WritableClosure
extends Closure
implements Writable


Nested Class Summary
 
Nested classes inherited from class groovy.lang.Closure
 
Field Summary
 
Fields inherited from class groovy.lang.Closure
DONE, SKIP
 
Fields inherited from class groovy.lang.GroovyObjectSupport
 
Constructor Summary
Closure.WritableClosure()
           
 
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.
 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
 boolean equals(java.lang.Object arg0)
           
 java.lang.Object getDelegate()
           
 java.lang.Class[] getParameterTypes()
           
 java.lang.Object getProperty(java.lang.String property)
           
 int hashCode()
           
 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 setProperty(java.lang.String property, java.lang.Object newValue)
          Sets the given property to the new value
 java.lang.String toString()
           
 java.io.Writer writeTo(java.io.Writer out)
          writes this object to the given stream
 
Methods inherited from class groovy.lang.Closure
getDirective, getMethod, getOwner, setDirective, throwRuntimeException
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Closure.WritableClosure

public Closure.WritableClosure()
Method Detail

writeTo

public java.io.Writer writeTo(java.io.Writer out)
                       throws java.io.IOException
Description copied from interface: Writable
writes this object to the given stream

Specified by:
writeTo in interface Writable
Throws:
java.io.IOException

invokeMethod

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

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

getProperty

public java.lang.Object getProperty(java.lang.String property)
Specified by:
getProperty in interface GroovyObject
Overrides:
getProperty in class Closure

setProperty

public void setProperty(java.lang.String property,
                        java.lang.Object newValue)
Description copied from interface: GroovyObject
Sets the given property to the new value

Specified by:
setProperty in interface GroovyObject
Overrides:
setProperty in class Closure

call

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

Overrides:
call in class Closure
Returns:
the value if applicable or null if there is no return statement in the closure

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

doCall

protected java.lang.Object doCall(java.lang.Object p1)
Description copied from class: 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

Overrides:
doCall in class Closure
Parameters:
p1 -
Returns:
the result of calling the closure

doCall

protected java.lang.Object doCall(java.lang.Object p1,
                                  java.lang.Object p2)
Description copied from class: Closure
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

Overrides:
doCall in class Closure
Parameters:
p1 -
Returns:
the result of calling the closure

getDelegate

public java.lang.Object getDelegate()
Overrides:
getDelegate in class Closure
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(java.lang.Object delegate)
Description copied from class: Closure
Allows the delegate to be changed such as when performing markup building

Overrides:
setDelegate in class Closure
Parameters:
delegate -

getParameterTypes

public java.lang.Class[] getParameterTypes()
Overrides:
getParameterTypes in class Closure
Returns:
the parameter types of this closure

asWritable

public Closure asWritable()
Overrides:
asWritable in class Closure
Returns:
a version of this closure which implements Writable

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class Closure

curry

public Closure curry(java.lang.Object[] arguments)
Description copied from class: Closure
Support for closure currying

Overrides:
curry in class Closure
Parameters:
arguments -

clone

public java.lang.Object clone()
Overrides:
clone in class Closure

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object arg0)

toString

public java.lang.String toString()


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