|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport groovy.lang.GroovyShell
public class GroovyShell extends GroovyObjectSupport
Represents a groovy shell capable of running arbitrary groovy scripts
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_CODE_BASE
|
Constructor Summary | |
GroovyShell()
|
|
GroovyShell(Binding binding)
|
|
GroovyShell(CompilerConfiguration config)
|
|
GroovyShell(Binding binding, CompilerConfiguration config)
|
|
GroovyShell(java.lang.ClassLoader parent, Binding binding)
|
|
GroovyShell(java.lang.ClassLoader parent)
|
|
GroovyShell(java.lang.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 | |
---|---|
java.lang.Object
|
evaluate(GroovyCodeSource codeSource)
|
java.lang.Object
|
evaluate(java.lang.String scriptText)
|
java.lang.Object
|
evaluate(java.lang.String scriptText, java.lang.String fileName)
|
java.lang.Object
|
evaluate(java.lang.String scriptText, java.lang.String fileName, java.lang.String codeBase)
|
java.lang.Object
|
evaluate(java.io.File file)
|
java.lang.Object
|
evaluate(java.io.Reader in)
|
java.lang.Object
|
evaluate(java.io.Reader in, java.lang.String fileName)
|
protected java.lang.String
|
generateScriptName()
|
GroovyClassLoader
|
getClassLoader()
|
Binding
|
getContext()
|
java.lang.Object
|
getProperty(java.lang.String property)
|
java.lang.Object
|
getVariable(java.lang.String name)
Evaluates some script against the current Binding and returns the result |
static void
|
main(java.lang.String[] args)
|
Script
|
parse(java.io.Reader reader, java.lang.String fileName)
Parses the given script and returns it ready to be run |
Script
|
parse(GroovyCodeSource codeSource)
Parses the given script and returns it ready to be run |
Script
|
parse(java.io.File file)
|
Script
|
parse(java.lang.String scriptText)
|
Script
|
parse(java.lang.String scriptText, java.lang.String fileName)
|
Script
|
parse(java.io.Reader in)
|
void
|
resetLoadedClasses()
|
java.lang.Object
|
run(java.io.File scriptFile, java.util.List list)
A helper method which runs the given script file with the given command line arguments |
java.lang.Object
|
run(java.lang.String scriptText, java.lang.String fileName, java.util.List list)
A helper method which runs the given cl script with the given command line arguments |
java.lang.Object
|
run(java.io.File scriptFile, java.lang.String[] args)
Runs the given script file name with the given command line arguments |
java.lang.Object
|
run(java.lang.String scriptText, java.lang.String fileName, java.lang.String[] args)
Runs the given script with command line arguments |
java.lang.Object
|
run(java.io.Reader in, java.lang.String fileName, java.lang.String[] args)
Evaluates some script against the current Binding and returns the result |
void
|
setProperty(java.lang.String property, java.lang.Object newValue)
|
void
|
setVariable(java.lang.String name, java.lang.Object value)
|
Methods inherited from class GroovyObjectSupport | |
---|---|
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), 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() |
Field Detail |
---|
public static final java.lang.String DEFAULT_CODE_BASE
Constructor Detail |
---|
public GroovyShell()
public GroovyShell(Binding binding)
public GroovyShell(CompilerConfiguration config)
public GroovyShell(Binding binding, CompilerConfiguration config)
public GroovyShell(java.lang.ClassLoader parent, Binding binding)
public GroovyShell(java.lang.ClassLoader parent)
public GroovyShell(java.lang.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 java.lang.Object evaluate(GroovyCodeSource codeSource)
public java.lang.Object evaluate(java.lang.String scriptText)
public java.lang.Object evaluate(java.lang.String scriptText, java.lang.String fileName)
public java.lang.Object evaluate(java.lang.String scriptText, java.lang.String fileName, java.lang.String codeBase)
public java.lang.Object evaluate(java.io.File file)
public java.lang.Object evaluate(java.io.Reader in)
public java.lang.Object evaluate(java.io.Reader in, java.lang.String fileName)
protected java.lang.String generateScriptName()
public GroovyClassLoader getClassLoader()
public Binding getContext()
public java.lang.Object getProperty(java.lang.String property)
public java.lang.Object getVariable(java.lang.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)
public static void main(java.lang.String[] args)
public Script parse(java.io.Reader reader, java.lang.String fileName)
file
- is the file of the script (which is used to create the class name of the script)
public Script parse(GroovyCodeSource codeSource)
in
- the stream reading the script
public Script parse(java.io.File file)
public Script parse(java.lang.String scriptText)
public Script parse(java.lang.String scriptText, java.lang.String fileName)
public Script parse(java.io.Reader in)
public void resetLoadedClasses()
public java.lang.Object run(java.io.File scriptFile, java.util.List list)
scriptFile
- the file of the script to runlist
- the command line arguments to pass in
public java.lang.Object run(java.lang.String scriptText, java.lang.String fileName, java.util.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 java.lang.Object run(java.io.File scriptFile, java.lang.String[] args)
scriptFile
- the file name of the script to runargs
- the command line arguments to pass in
public java.lang.Object run(java.lang.String scriptText, java.lang.String fileName, java.lang.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 java.lang.Object run(java.io.Reader in, java.lang.String fileName, java.lang.String[] args)
scriptText
- the text of the script
public void setProperty(java.lang.String property, java.lang.Object newValue)
public void setVariable(java.lang.String name, java.lang.Object value)
Groovy Documentation