|
Groovy 1.8.4 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.util.GroovyScriptEngine
public class GroovyScriptEngine extends Object
Specific script engine able to reload modified scripts as well as dealing properly with dependent scripts.
Method Summary | |
---|---|
def
|
GroovyScriptEngine(URL[] roots)
|
def
|
GroovyScriptEngine(URL[] roots, ClassLoader parentClassLoader)
|
def
|
GroovyScriptEngine(String[] urls)
|
def
|
GroovyScriptEngine(String[] urls, ClassLoader parentClassLoader)
|
def
|
GroovyScriptEngine(String url)
|
def
|
GroovyScriptEngine(String url, ClassLoader parentClassLoader)
|
def
|
GroovyScriptEngine(ResourceConnector rc)
|
def
|
GroovyScriptEngine(ResourceConnector rc, ClassLoader parentClassLoader)
|
Script
|
createScript(String scriptName, Binding binding)
Creates a Script with a given scriptName and binding. |
CompilerConfiguration
|
getConfig()
@return a non null compiler configuration |
GroovyClassLoader
|
getGroovyClassLoader()
Returns the GroovyClassLoader associated with this script engine instance. |
ClassLoader
|
getParentClassLoader()
Get the |
URLConnection
|
getResourceConnection(String resourceName)
Get a resource connection as a |
protected boolean
|
isSourceNewer(GroovyScriptEngine.ScriptCacheEntry entry)
|
Class
|
loadScriptByName(String scriptName)
Get the class of the scriptName in question, so that you can instantiate Groovy objects with caching and reloading. |
Class
|
loadScriptByName(String scriptName, ClassLoader parentClassLoader)
Get the class of the scriptName in question, so that you can instantiate Groovy objects with caching and reloading. |
static void
|
main(String[] urls)
Simple testing harness for the GSE. |
String
|
run(String scriptName, String argument)
Run a script identified by name with a single argument. |
Object
|
run(String scriptName, Binding binding)
Run a script identified by name with a given binding. |
void
|
setConfig(CompilerConfiguration config)
sets a compiler configuration |
void
|
setParentClassLoader(ClassLoader parentClassLoader)
@deprecated
|
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Method Detail |
---|
public def GroovyScriptEngine(URL[] roots)
public def GroovyScriptEngine(URL[] roots, ClassLoader parentClassLoader)
public def GroovyScriptEngine(String[] urls)
public def GroovyScriptEngine(String[] urls, ClassLoader parentClassLoader)
public def GroovyScriptEngine(String url)
public def GroovyScriptEngine(String url, ClassLoader parentClassLoader)
public def GroovyScriptEngine(ResourceConnector rc)
public def GroovyScriptEngine(ResourceConnector rc, ClassLoader parentClassLoader)
public Script createScript(String scriptName, Binding binding)
scriptName
- name of the script to runbinding
- the binding to pass to the script
public CompilerConfiguration getConfig()
public GroovyClassLoader getGroovyClassLoader()
public ClassLoader getParentClassLoader()
ClassLoader
that will serve as the parent ClassLoader of the
GroovyClassLoader in which scripts will be executed. By default, this is the
ClassLoader that loaded the GroovyScriptEngine
class.
public URLConnection getResourceConnection(String resourceName)
URLConnection
to retrieve a script
from the ResourceConnector
.resourceName
- name of the resource to be retrieved
protected boolean isSourceNewer(GroovyScriptEngine.ScriptCacheEntry entry)
public Class loadScriptByName(String scriptName)
scriptName
- resource name pointing to the script
public Class loadScriptByName(String scriptName, ClassLoader parentClassLoader)
scriptName
- resource name pointing to the scriptparentClassLoader
- the class loader to use when loading the script
public static void main(String[] urls)
urls
- an array of URLs
public String run(String scriptName, String argument)
scriptName
- name of the script to runargument
- a single argument passed as a variable named arg
in the bindingtoString()
representation of the result of the execution of the script
public Object run(String scriptName, Binding binding)
scriptName
- name of the script to runbinding
- the binding to pass to the script
public void setConfig(CompilerConfiguration config)
config
- - the compiler configuration
public void setParentClassLoader(ClassLoader parentClassLoader)
parentClassLoader
- ClassLoader to be used as the parent ClassLoader
for scripts executed by the engine
Copyright © 2003-2011 The Codehaus. All rights reserved.