groovy.lang
Class Script

This object represents a Groovy script

author:
James Strachan
author:
Guillaume Laforge
version:
$Revision: 10598 $

Field Summary
 Binding binding
           
 
Constructor Summary
Script()
           
Script(Binding binding)
           
 
Method Summary
Object evaluate(String expression)
           A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope
Object evaluate(File file)
           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)
          
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.
Object run()
          
void run(File file, def arguments)
           A helper method to allow scripts to be run taking command line arguments
void setBinding(Binding binding)
          
void setProperty(String property, Object newValue)
          
 

Constructor Detail

Script

Script()


Script

Script(Binding binding)


Method Detail

evaluate

public Object evaluate(String expression)
A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope
param:
expression is the Groovy script expression to evaluate


evaluate

public Object evaluate(File file)
A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope
param:
file is the Groovy script to evaluate


getBinding

public Binding getBinding()


getProperty

public Object getProperty(String property)


invokeMethod

public Object invokeMethod(String name, Object args)
Invoke a method (or closure in the binding) defined.
param:
name method to call
param:
args arguments to pass to the method
return:
value


print

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. If there is no 'out' property then print to standard out.


println

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. If there is no 'out' property then print to standard out.


println

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. If there is no 'out' property then print to standard out.


run

public Object run()


run

public void run(File file, def arguments)
A helper method to allow scripts to be run taking command line arguments


setBinding

public void setBinding(Binding binding)


setProperty

public void setProperty(String property, Object newValue)