Package org.kohsuke.stapler.jelly.groovy
Class GroovyClosureScript
- java.lang.Object
-
- groovy.lang.GroovyObjectSupport
-
- groovy.lang.Script
-
- org.kohsuke.stapler.jelly.groovy.GroovyClosureScript
-
- All Implemented Interfaces:
groovy.lang.GroovyObject
- Direct Known Subclasses:
StaplerClosureScript
public abstract class GroovyClosureScript extends groovy.lang.ScriptScriptthat performs method invocations and property access likeClosuredoes.For example, when the script is:
Usinga = 1; b(2);GroovyClosureScriptas the base class would run it as:
... whereas in plaindelegate.a = 1; delegate.b(2);Script, this will be run as:
This is convenient for building DSL as you can use an external object to define methods and properties.binding.setProperty("a",1); ((Closure)binding.getProperty("b")).call(2);- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGroovyClosureScript()protectedGroovyClosureScript(groovy.lang.Binding binding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description groovy.lang.GroovyObjectgetDelegate()ObjectgetProperty(String property)ObjectinvokeMethod(String name, Object args)voidsetDelegate(groovy.lang.GroovyObject delegate)Sets the delegation target.voidsetProperty(String property, Object newValue)
-
-
-
Method Detail
-
setDelegate
public void setDelegate(groovy.lang.GroovyObject delegate)
Sets the delegation target.
-
getDelegate
public groovy.lang.GroovyObject getDelegate()
-
invokeMethod
public Object invokeMethod(String name, Object args)
- Specified by:
invokeMethodin interfacegroovy.lang.GroovyObject- Overrides:
invokeMethodin classgroovy.lang.Script
-
getProperty
public Object getProperty(String property)
- Specified by:
getPropertyin interfacegroovy.lang.GroovyObject- Overrides:
getPropertyin classgroovy.lang.Script
-
-