|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.lang.Script
public abstract class Script
This object represents a Groovy script
Constructor Summary | |
---|---|
protected |
Script()
|
protected |
Script(Binding binding)
|
Method Summary | |
---|---|
Object |
evaluate(File file)
A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope |
Object |
evaluate(String expression)
A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope |
Binding |
getBinding()
|
Object |
getProperty(String property)
Retrieves a property value. |
Object |
invokeMethod(String name,
Object args)
Invoke a method (or closure in the binding) defined. |
void |
print(Object value)
Prints the value to the current 'out' variable which should be a PrintWriter or at least have a print() method defined on it. |
void |
println()
Prints a newline to the current 'out' variable which should be a PrintWriter or at least have a println() method defined on it. |
void |
println(Object value)
Prints the value and a newline to the current 'out' variable which should be a PrintWriter or at least have a println() method defined on it. |
abstract Object |
run()
The main instance method of a script which has variables in scope as defined by the current Binding instance. |
void |
run(File file,
String[] arguments)
A helper method to allow scripts to be run taking command line arguments |
void |
setBinding(Binding binding)
|
void |
setProperty(String property,
Object newValue)
Sets the given property to the new value. |
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 |
---|
protected Script()
protected Script(Binding binding)
Method Detail |
---|
public Binding getBinding()
public void setBinding(Binding binding)
public Object getProperty(String property)
GroovyObject
getProperty
in interface GroovyObject
getProperty
in class GroovyObjectSupport
property
- the name of the property of interest
public void setProperty(String property, Object newValue)
GroovyObject
setProperty
in interface GroovyObject
setProperty
in class GroovyObjectSupport
property
- the name of the property of interestnewValue
- the new value for the propertypublic Object invokeMethod(String name, Object args)
invokeMethod
in interface GroovyObject
invokeMethod
in class GroovyObjectSupport
name
- method to callargs
- arguments to pass to the method
public abstract Object run()
Binding
instance.
public void println()
public void print(Object value)
public void println(Object value)
public Object evaluate(String expression) throws CompilationFailedException
expression
- is the Groovy script expression to evaluate
CompilationFailedException
public Object evaluate(File file) throws CompilationFailedException, IOException
file
- is the Groovy script to evaluate
CompilationFailedException
IOException
public void run(File file, String[] arguments) throws CompilationFailedException, IOException
CompilationFailedException
IOException
|
Copyright © 2003-2009 The Codehaus. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |