public abstract class Script
extends GroovyObjectSupport
This object represents a Groovy script
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Object |
evaluate(String expression)A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope |
|
public Object |
evaluate(File file)A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope |
|
public Binding |
getBinding()Returns the binding used to resolve script variables. |
|
public Object |
getProperty(String property)Retrieves a property value.
|
|
public Object |
invokeMethod(String name, Object args)Invoke a method (or closure in the binding) defined. |
|
public 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. |
|
public void |
printf(String format, Object value)Prints a formatted string using the specified format string and argument. |
|
public void |
printf(String format, Object[] values)Prints a formatted string using the specified format string and arguments. |
|
public 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. |
|
public 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. |
|
public abstract Object |
run()The main instance method of a script which has variables in scope as defined by the current Binding instance. |
|
public void |
run(File file, String[] arguments)A helper method to allow scripts to be run taking command line arguments |
|
public void |
setBinding(Binding binding)Replaces the binding used to resolve script variables. |
|
public void |
setProperty(String property, Object newValue)Sets the given property to the new value.
|
| Methods inherited from class | Name |
|---|---|
class GroovyObjectSupport |
getMetaClass, setMetaClass |
Creates a script with a fresh Binding.
Creates a script backed by the supplied binding.
binding - the binding that supplies script variablesA helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope
expression - is the Groovy script expression to evaluateA helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope
file - is the Groovy script to evaluateReturns the binding used to resolve script variables.
Retrieves a property value.
propertyName - the name of the property of interestInvoke a method (or closure in the binding) defined.
name - method to callargs - arguments to pass to the methodPrints the value to the current 'out' variable which should be a PrintWriter or at least have a print() method defined on it. If there is no 'out' property then print to standard out.
Prints a formatted string using the specified format string and argument.
format - the format to followvalue - the value to be formattedPrints a formatted string using the specified format string and arguments.
format - the format to followvalues - an array of values to be formattedPrints a newline to the current 'out' variable which should be a PrintWriter or at least have a println() method defined on it. If there is no 'out' property then print to standard out.
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. If there is no 'out' property then print to standard out.
The main instance method of a script which has variables in scope as defined by the current Binding instance.
A helper method to allow scripts to be run taking command line arguments
Replaces the binding used to resolve script variables.
binding - the new script bindingCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.