Package groovy.lang
Class Script
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Script
- All Implemented Interfaces:
- GroovyObject
- Direct Known Subclasses:
- DelegatingScript,- GroovyTypeCheckingExtensionSupport.TypeCheckingDSL
This object represents a Groovy script
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionA helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scopeA helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scopegetProperty(String property) Retrieves a property value.invokeMethod(String name, Object args) Invoke a method (or closure in the binding) defined.voidPrints the value to the current 'out' variable which should be a PrintWriter or at least have a print() method defined on it.voidPrints a formatted string using the specified format string and argument.voidPrints 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.voidPrints 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 Objectrun()The main instance method of a script which has variables in scope as defined by the currentBindinginstance.voidA helper method to allow scripts to be run taking command line argumentsvoidsetBinding(Binding binding) voidsetProperty(String property, Object newValue) Sets the given property to the new value.Methods inherited from class groovy.lang.GroovyObjectSupportgetMetaClass, setMetaClass
- 
Constructor Details- 
Scriptprotected Script()
- 
Script
 
- 
- 
Method Details- 
getBinding
- 
setBinding
- 
getPropertyDescription copied from interface:GroovyObjectRetrieves a property value.- Parameters:
- property- the name of the property of interest
- Returns:
- the given property
 
- 
setPropertyDescription copied from interface:GroovyObjectSets the given property to the new value.- Parameters:
- property- the name of the property of interest
- newValue- the new value for the property
 
- 
invokeMethodInvoke a method (or closure in the binding) defined.- Parameters:
- name- method to call
- args- arguments to pass to the method
- Returns:
- value
 
- 
runThe 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.
- 
printPrints 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.
- 
printlnPrints 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.
- 
printfPrints a formatted string using the specified format string and argument.- Parameters:
- format- the format to follow
- value- the value to be formatted
 
- 
printfPrints a formatted string using the specified format string and arguments.- Parameters:
- format- the format to follow
- values- an array of values to be formatted
 
- 
evaluateA 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
 
- 
evaluateA 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
- IOException
 
- 
runA helper method to allow scripts to be run taking command line arguments
 
-