|
Groovy 1.8.8 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.lang.GroovyShell
public class GroovyShell extends GroovyObjectSupport
Represents a groovy shell capable of running arbitrary groovy scripts
Field Summary | |
---|---|
static String |
DEFAULT_CODE_BASE
|
static String[] |
EMPTY_ARGS
|
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 | |
---|---|
Object
|
evaluate(GroovyCodeSource codeSource)
|
Object
|
evaluate(String scriptText)
Evaluates some script against the current Binding and returns the result |
Object
|
evaluate(String scriptText, String fileName)
Evaluates some script against the current Binding and returns the result |
Object
|
evaluate(String scriptText, String fileName, String codeBase)
Evaluates some script against the current Binding and returns the result |
Object
|
evaluate(File file)
Evaluates some script against the current Binding and returns the result |
Object
|
evaluate(Reader in)
|
Object
|
evaluate(Reader in, String fileName)
|
Object
|
evaluate(InputStream in)
Parses the given script and returns it ready to be run |
Object
|
evaluate(InputStream in, String fileName)
|
protected String
|
generateScriptName()
|
GroovyClassLoader
|
getClassLoader()
|
Binding
|
getContext()
|
Object
|
getProperty(String property)
|
Object
|
getVariable(String name)
Evaluates some script against the current Binding and returns the result |
void
|
initializeBinding()
|
static void
|
main(String[] args)
|
Script
|
parse(Reader reader, String fileName)
Parses the groovy code contained in codeSource and returns a java class. |
Script
|
parse(InputStream in, String fileName)
|
Script
|
parse(GroovyCodeSource codeSource)
Parses the given script and returns it ready to be run |
Script
|
parse(File file)
Parses the given script and returns it ready to be run |
Script
|
parse(String scriptText)
|
Script
|
parse(String scriptText, String fileName)
|
Script
|
parse(Reader in)
|
Script
|
parse(InputStream in)
|
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, String[] args)
Runs the given script file name with the given command line arguments |
Object
|
run(String scriptText, String fileName, String[] args)
Runs the given script with command line arguments |
Object
|
run(Reader in, String fileName, String[] args)
|
Object
|
run(InputStream in, String fileName, String[] args)
Evaluates some script against the current Binding and returns the result |
void
|
setProperty(String property, Object newValue)
|
void
|
setVariable(String name, Object value)
Evaluates some script against the current Binding and returns the result. |
Methods inherited from class GroovyObjectSupport | |
---|---|
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
public static final String DEFAULT_CODE_BASE
@Deprecated public static final String[] EMPTY_ARGS
Constructor Detail |
---|
public GroovyShell()
public GroovyShell(Binding binding)
public GroovyShell(CompilerConfiguration config)
public GroovyShell(Binding binding, CompilerConfiguration config)
public GroovyShell(ClassLoader parent, Binding binding)
public GroovyShell(ClassLoader parent)
public GroovyShell(ClassLoader parent, Binding binding, CompilerConfiguration config)
public GroovyShell(GroovyShell shell)
shell
- is the parent shell used for the variable bindings and the parent class loader
Method Detail |
---|
public Object evaluate(GroovyCodeSource codeSource)
public Object evaluate(String scriptText)
file
- is the file of the script (which is used to create the class name of the script)
public Object evaluate(String scriptText, String fileName)
in
- the stream reading the script
public Object evaluate(String scriptText, String fileName, String codeBase)
in
- the stream reading the scriptfileName
- is the logical file name of the script (which is used to create the class name of the script)
public Object evaluate(File file)
in
- the stream reading the script
public Object evaluate(Reader in)
public Object evaluate(Reader in, String fileName)
public Object evaluate(InputStream in)
reader
- the stream reading the scriptfileName
- is the logical file name of the script (which is used to create the class name of the script)
public Object evaluate(InputStream in, String fileName)
protected String generateScriptName()
public GroovyClassLoader getClassLoader()
public Binding getContext()
public Object getProperty(String property)
public Object getVariable(String name)
scriptText
- the text of the scriptfileName
- is the logical file name of the script (which is used to create the class name of the script)
@Deprecated public void initializeBinding()
public static void main(String[] args)
public Script parse(Reader reader, String fileName)
public Script parse(InputStream in, String fileName)
public Script parse(GroovyCodeSource codeSource)
in
- the stream reading the script
public Script parse(File file)
in
- the stream reading the script
public Script parse(String scriptText)
public Script parse(String scriptText, String fileName)
public Script parse(Reader in)
public Script parse(InputStream in)
public void resetLoadedClasses()
public Object run(File scriptFile, List list)
scriptFile
- the file of the script to runlist
- the command line arguments to pass in
public Object run(String scriptText, String fileName, List list)
scriptText
- is the text content of the scriptfileName
- is the logical file name of the script (which is used to create the class name of the script)list
- the command line arguments to pass in
public Object run(File scriptFile, String[] args)
scriptFile
- the file name of the script to runargs
- the command line arguments to pass in
public Object run(String scriptText, String fileName, String[] args)
in
- the stream reading the scriptfileName
- is the logical file name of the script (which is used to create the class name of the script)args
- the command line arguments to pass in
public Object run(Reader in, String fileName, String[] args)
public Object run(InputStream in, String fileName, String[] args)
public void setProperty(String property, Object newValue)
public void setVariable(String name, Object value)
Copyright © 2003-2012 The Codehaus. All rights reserved.