|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.lang.GroovyShell
public class GroovyShell
Represents a groovy shell capable of running arbitrary groovy scripts
Field Summary | |
---|---|
static String |
DEFAULT_CODE_BASE
|
static String[] |
EMPTY_ARGS
Deprecated. |
Constructor Summary | |
---|---|
GroovyShell()
|
|
GroovyShell(Binding binding)
|
|
GroovyShell(Binding binding,
CompilerConfiguration config)
|
|
GroovyShell(ClassLoader parent)
|
|
GroovyShell(ClassLoader parent,
Binding binding)
|
|
GroovyShell(ClassLoader parent,
Binding binding,
CompilerConfiguration config)
|
|
GroovyShell(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(File file)
Evaluates some script against the current Binding and returns the result |
Object |
evaluate(GroovyCodeSource codeSource)
Evaluates some script against the current Binding and returns the result |
Object |
evaluate(InputStream in)
Deprecated. Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues. |
Object |
evaluate(InputStream in,
String fileName)
Deprecated. Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues. |
Object |
evaluate(Reader in)
Evaluates some script against the current Binding and returns the result |
Object |
evaluate(Reader in,
String fileName)
Evaluates some script against the current Binding and returns the result |
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. |
protected String |
generateScriptName()
|
GroovyClassLoader |
getClassLoader()
|
Binding |
getContext()
|
Object |
getProperty(String property)
Retrieves a property value. |
Object |
getVariable(String name)
|
void |
initializeBinding()
Deprecated. |
static void |
main(String[] args)
|
Script |
parse(File file)
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(InputStream in)
Deprecated. Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues. |
Script |
parse(InputStream in,
String fileName)
Deprecated. Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues. |
Script |
parse(Reader in)
Parses the given script and returns it ready to be run |
Script |
parse(Reader reader,
String fileName)
Parses the given script and returns it ready to be run |
Script |
parse(String scriptText)
Parses the given script and returns it ready to be run |
Script |
parse(String scriptText,
String fileName)
|
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(File scriptFile,
String[] args)
Runs the given script file name with the given command line arguments |
Object |
run(InputStream in,
String fileName,
String[] args)
Deprecated. Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues. |
Object |
run(Reader in,
String fileName,
String[] args)
Runs the given script with 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(String scriptText,
String fileName,
String[] args)
Runs the given script text with command line arguments |
void |
setProperty(String property,
Object newValue)
Sets the given property to the new value. |
void |
setVariable(String name,
Object value)
|
Methods inherited from class groovy.lang.GroovyObjectSupport |
---|
getMetaClass, invokeMethod, setMetaClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 loaderMethod Detail |
---|
public static void main(String[] args)
@Deprecated public void initializeBinding()
public void resetLoadedClasses()
public Binding getContext()
public GroovyClassLoader getClassLoader()
public Object getProperty(String property)
GroovyObject
getProperty
in interface GroovyObject
getProperty
in class GroovyObjectSupport
property
- the name of the property of interest
public void setProperty(String property, Object newValue)
GroovyObject
setProperty
in interface GroovyObject
setProperty
in class GroovyObjectSupport
property
- the name of the property of interestnewValue
- the new value for the propertypublic Object run(File scriptFile, List list) throws CompilationFailedException, IOException
scriptFile
- the file of the script to runlist
- the command line arguments to pass in
CompilationFailedException
IOException
public Object run(String scriptText, String fileName, List list) throws CompilationFailedException
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
CompilationFailedException
public Object run(File scriptFile, String[] args) throws CompilationFailedException, IOException
scriptFile
- the file name of the script to runargs
- the command line arguments to pass in
CompilationFailedException
IOException
public Object run(String scriptText, String fileName, String[] args) throws CompilationFailedException
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)args
- the command line arguments to pass in
CompilationFailedException
public Object run(Reader in, String fileName, String[] args) throws CompilationFailedException
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
CompilationFailedException
public Object run(InputStream in, String fileName, String[] args) throws CompilationFailedException
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
CompilationFailedException
public Object getVariable(String name)
public void setVariable(String name, Object value)
public Object evaluate(GroovyCodeSource codeSource) throws CompilationFailedException
codeSource
-
CompilationFailedException
public Object evaluate(String scriptText) throws CompilationFailedException
scriptText
- the text of the script
CompilationFailedException
public Object evaluate(String scriptText, String fileName) throws CompilationFailedException
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)
CompilationFailedException
public Object evaluate(String scriptText, String fileName, String codeBase) throws CompilationFailedException
CompilationFailedException
public Object evaluate(File file) throws CompilationFailedException, IOException
file
- is the file of the script (which is used to create the class name of the script)
CompilationFailedException
IOException
public Object evaluate(Reader in) throws CompilationFailedException
in
- the stream reading the script
CompilationFailedException
public Object evaluate(Reader in, String fileName) throws CompilationFailedException
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)
CompilationFailedException
public Object evaluate(InputStream in) throws CompilationFailedException
in
- the stream reading the script
CompilationFailedException
public Object evaluate(InputStream in, String fileName) throws CompilationFailedException
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)
CompilationFailedException
public Script parse(Reader reader, String fileName) throws CompilationFailedException
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)
Script.run()
CompilationFailedException
public Script parse(InputStream in, String fileName) throws CompilationFailedException
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)
CompilationFailedException
public Script parse(GroovyCodeSource codeSource) throws CompilationFailedException
codeSource
-
CompilationFailedException
public Script parse(File file) throws CompilationFailedException, IOException
file
- is the file of the script (which is used to create the class name of the script)
CompilationFailedException
IOException
public Script parse(String scriptText) throws CompilationFailedException
scriptText
- the text of the script
CompilationFailedException
public Script parse(String scriptText, String fileName) throws CompilationFailedException
CompilationFailedException
public Script parse(Reader in) throws CompilationFailedException
in
- the stream reading the script
CompilationFailedException
public Script parse(InputStream in) throws CompilationFailedException
in
- the stream reading the script
CompilationFailedException
protected String generateScriptName()
|
Copyright © 2003-2012 The Codehaus. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |