groovy.lang
Class GroovyShell

Represents a groovy shell capable of running arbitrary groovy scripts

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

Field Summary
 def EMPTY_ARGS
           
 CompilerConfiguration config
           
 Binding context
           
 int counter
           
 GroovyClassLoader loader
           
 
Constructor Summary
GroovyShell()
           
GroovyShell(Binding binding)
           
GroovyShell(CompilerConfiguration config)
           
GroovyShell(Binding binding, CompilerConfiguration config)
           
GroovyShell(ClassLoader parent, Binding binding)
           
GroovyShell(ClassLoader parent)
           
GroovyShell(ClassLoader parent, Binding binding, CompilerConfiguration config)
           
GroovyShell(GroovyShell shell)
            Creates a child shell using a new ClassLoader which uses the parent shell's class loader as its parent
 
Method Summary
GroovyClassLoader getClassLoader()
          
Binding getContext()
          
Object getProperty(String property)
          
void initializeBinding()
          
static void main(def args)
          
void resetLoadedClasses()
          
Object run(File scriptFile, List list)
           A helper method which runs the given script file with the given command line arguments
Object run(String scriptText, String fileName, List list)
           A helper method which runs the given cl script with the given command line arguments
Object run(File scriptFile, def args)
           Runs the given script file name with the given command line arguments
void setProperty(String property, Object newValue)
          
 

Constructor Detail

GroovyShell

public GroovyShell()


GroovyShell

public GroovyShell(Binding binding)


GroovyShell

public GroovyShell(CompilerConfiguration config)


GroovyShell

public GroovyShell(Binding binding, CompilerConfiguration config)


GroovyShell

public GroovyShell(ClassLoader parent, Binding binding)


GroovyShell

public GroovyShell(ClassLoader parent)


GroovyShell

public GroovyShell(ClassLoader parent, Binding binding, CompilerConfiguration config)


GroovyShell

public GroovyShell(GroovyShell shell)
Creates a child shell using a new ClassLoader which uses the parent shell's class loader as its parent
param:
shell is the parent shell used for the variable bindings and the parent class loader


Method Detail

getClassLoader

public GroovyClassLoader getClassLoader()


getContext

public Binding getContext()


getProperty

public Object getProperty(String property)


initializeBinding

public void initializeBinding()


main

public static void main(def args)


resetLoadedClasses

public void resetLoadedClasses()


run

public Object run(File scriptFile, List list)
A helper method which runs the given script file with the given command line arguments
param:
scriptFile the file of the script to run
param:
list the command line arguments to pass in


run

public Object run(String scriptText, String fileName, List list)
A helper method which runs the given cl script with the given command line arguments
param:
scriptText is the text content of the script
param:
fileName is the logical file name of the script (which is used to create the class name of the script)
param:
list the command line arguments to pass in


run

public Object run(File scriptFile, def args)
Runs the given script file name with the given command line arguments
param:
scriptFile the file name of the script to run
param:
args the command line arguments to pass in


setProperty

public void setProperty(String property, Object newValue)