Groovy Documentation

## groovy.lang
[Java] Class Script

    java.lang.Object
      groovy.lang.GroovyObjectSupport
          groovy.lang.Script

    public abstract class Script
    extends GroovyObjectSupport

This object represents a Groovy script

Authors:
  James Strachan
  Guillaume Laforge

Version:
  \$Revision\$

Constructor Summary
`protected Script()`
`protected Script(Binding binding)`

Method Summary
`java.lang.Object` | `evaluate(java.lang.String expression)` A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope
`java.lang.Object` | `evaluate(java.io.File file)` A helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope
`Binding` | `getBinding()`
`java.lang.Object` | `getProperty(java.lang.String property)`
`java.lang.Object` | `invokeMethod(java.lang.String name, java.lang.Object args)` Invoke a method (or closure in the binding) defined.
`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.
`void` | `printf(java.lang.String format, java.lang.Object value)` Prints a formatted string using the specified format string and argument.
`void` | `printf(java.lang.String format, java.lang.Object[] values)` Prints a formatted string using the specified format string and arguments.
`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(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.
`java.lang.Object` | `run()` The main instance method of a script which has variables in scope as defined by the current Binding instance.
`void` | `run(java.io.File file, java.lang.String[] arguments)` A helper method to allow scripts to be run taking command line arguments
`void` | `setBinding(Binding binding)`
`void` | `setProperty(java.lang.String property, java.lang.Object newValue)`

Methods inherited from class GroovyObjectSupport
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### Script

    protected Script()

### Script

    protected Script(Binding binding)

Method Detail

### evaluate

    public java.lang.Object evaluate(java.lang.String expression)

  A 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

### evaluate

    public java.lang.Object evaluate(java.io.File file)

  A 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

### getBinding

    public Binding getBinding()

### getProperty

    public java.lang.Object getProperty(java.lang.String property)

### invokeMethod

    public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)

  Invoke a method (or closure in the binding) defined.
  Parameters:
    `name` - method to call
    `args` - arguments to pass to the method
  Returns:
    value

### print

    public 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.

### printf

    public 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

### printf

    public 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

### 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(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.

### run

    public java.lang.Object run()

  The main instance method of a script which has variables in scope as defined by the current Binding instance.

### run

    public void run(java.io.File file, java.lang.String[] arguments)

  A helper method to allow scripts to be run taking command line arguments

### setBinding

    public void setBinding(Binding binding)

### setProperty

    public void setProperty(java.lang.String property, java.lang.Object newValue)

Groovy Documentation