hudson.util.spring
Class ClosureScript

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.lang.Script
          extended by hudson.util.spring.ClosureScript
All Implemented Interfaces:
groovy.lang.GroovyObject

public abstract class ClosureScript
extends groovy.lang.Script

Script that performs method invocations and property access like Closure does.

For example, when the script is:

 a = 1;
 b(2);
 

 

Using ClosureScript as the base class would run it as:

 delegate.a = 1;
 delegate.b(2);
 
... whereas in plain Script, this will be run as:
 binding.setProperty("a",1);
 ((Closure)binding.getProperty("b")).call(2);
 

Author:
Kohsuke Kawaguchi

Constructor Summary
protected ClosureScript()
           
protected ClosureScript(groovy.lang.Binding binding)
           
 
Method Summary
 Object getProperty(String property)
           
 Object invokeMethod(String name, Object args)
           
 void setDelegate(groovy.lang.GroovyObject delegate)
          Sets the delegation target.
 void setProperty(String property, Object newValue)
           
 
Methods inherited from class groovy.lang.Script
evaluate, evaluate, getBinding, print, printf, printf, println, println, run, run, setBinding
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClosureScript

protected ClosureScript()

ClosureScript

protected ClosureScript(groovy.lang.Binding binding)
Method Detail

setDelegate

public void setDelegate(groovy.lang.GroovyObject delegate)
Sets the delegation target.


invokeMethod

public Object invokeMethod(String name,
                           Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject
Overrides:
invokeMethod in class groovy.lang.Script

getProperty

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

setProperty

public void setProperty(String property,
                        Object newValue)
Specified by:
setProperty in interface groovy.lang.GroovyObject
Overrides:
setProperty in class groovy.lang.Script


Copyright © 2004-2013. All Rights Reserved.