Package groovy.lang
Class Script
- java.lang.Object
- 
- groovy.lang.GroovyObjectSupport
- 
- groovy.lang.Script
 
 
- 
- All Implemented Interfaces:
- GroovyObject
 - Direct Known Subclasses:
- DelegatingScript,- GroovyTypeCheckingExtensionSupport.TypeCheckingDSL
 
 public abstract class Script extends GroovyObjectSupport This object represents a Groovy script
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Objectevaluate(java.io.File file)A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scopejava.lang.Objectevaluate(java.lang.String expression)A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scopeBindinggetBinding()java.lang.ObjectgetProperty(java.lang.String property)Retrieves a property value.java.lang.ObjectinvokeMethod(java.lang.String name, java.lang.Object args)Invoke a method (or closure in the binding) defined.voidprint(java.lang.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.voidprintf(java.lang.String format, java.lang.Object value)Prints a formatted string using the specified format string and argument.voidprintf(java.lang.String format, java.lang.Object[] values)Prints a formatted string using the specified format string and arguments.voidprintln()Prints a newline to the current 'out' variable which should be a PrintWriter or at least have a println() method defined on it.voidprintln(java.lang.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 java.lang.Objectrun()The main instance method of a script which has variables in scope as defined by the currentBindinginstance.voidrun(java.io.File file, java.lang.String[] arguments)A helper method to allow scripts to be run taking command line argumentsvoidsetBinding(Binding binding)voidsetProperty(java.lang.String property, java.lang.Object newValue)Sets the given property to the new value.- 
Methods inherited from class groovy.lang.GroovyObjectSupportgetMetaClass, setMetaClass
 
- 
 
- 
- 
- 
Constructor Detail- 
Scriptprotected Script() 
 - 
Scriptprotected Script(Binding binding) 
 
- 
 - 
Method Detail- 
getBindingpublic Binding getBinding() 
 - 
setBindingpublic void setBinding(Binding binding) 
 - 
getPropertypublic java.lang.Object getProperty(java.lang.String property) Description copied from interface:GroovyObjectRetrieves a property value.- Specified by:
- getPropertyin interface- GroovyObject
- Overrides:
- getPropertyin class- GroovyObjectSupport
- Parameters:
- property- the name of the property of interest
- Returns:
- the given property
 
 - 
setPropertypublic void setProperty(java.lang.String property, java.lang.Object newValue)Description copied from interface:GroovyObjectSets the given property to the new value.- Specified by:
- setPropertyin interface- GroovyObject
- Overrides:
- setPropertyin class- GroovyObjectSupport
- Parameters:
- property- the name of the property of interest
- newValue- the new value for the property
 
 - 
invokeMethodpublic java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)Invoke a method (or closure in the binding) defined.- Specified by:
- invokeMethodin interface- GroovyObject
- Overrides:
- invokeMethodin class- GroovyObjectSupport
- Parameters:
- name- method to call
- args- arguments to pass to the method
- Returns:
- value
 
 - 
runpublic abstract java.lang.Object run() The main instance method of a script which has variables in scope as defined by the currentBindinginstance.
 - 
printlnpublic 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. If there is no 'out' property then print to standard out.
 - 
printpublic void print(java.lang.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. If there is no 'out' property then print to standard out.
 - 
printlnpublic void println(java.lang.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. If there is no 'out' property then print to standard out.
 - 
printfpublic void printf(java.lang.String format, java.lang.Object value)Prints a formatted string using the specified format string and argument.- Parameters:
- format- the format to follow
- value- the value to be formatted
 
 - 
printfpublic void printf(java.lang.String format, java.lang.Object[] values)Prints a formatted string using the specified format string and arguments.- Parameters:
- format- the format to follow
- values- an array of values to be formatted
 
 - 
evaluatepublic java.lang.Object evaluate(java.lang.String expression) throws CompilationFailedExceptionA helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope- Parameters:
- expression- is the Groovy script expression to evaluate
- Throws:
- CompilationFailedException
 
 - 
evaluatepublic java.lang.Object evaluate(java.io.File file) throws CompilationFailedException, java.io.IOExceptionA helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope- Parameters:
- file- is the Groovy script to evaluate
- Throws:
- CompilationFailedException
- java.io.IOException
 
 - 
runpublic void run(java.io.File file, java.lang.String[] arguments) throws CompilationFailedException, java.io.IOExceptionA helper method to allow scripts to be run taking command line arguments- Throws:
- CompilationFailedException
- java.io.IOException
 
 
- 
 
-