Groovy Documentation

groovy.util
[Java] Class GroovyScriptEngine

java.lang.Object
  groovy.util.GroovyScriptEngine
All Implemented Interfaces:
ResourceConnector

public class GroovyScriptEngine
extends java.lang.Object

Specific script engine able to reload modified scripts as well as dealing properly with dependent scripts.

Authors:
sam
Marc Palmer
Guillaume Laforge
Jochen Theodorou
Mattias Reichel


Method Summary
java.lang.Object GroovyScriptEngine(java.net.URL[] roots)

java.lang.Object GroovyScriptEngine(java.net.URL[] roots, java.lang.ClassLoader parentClassLoader)

java.lang.Object GroovyScriptEngine(java.lang.String[] urls)

java.lang.Object GroovyScriptEngine(java.lang.String[] urls, java.lang.ClassLoader parentClassLoader)

java.lang.Object GroovyScriptEngine(java.lang.String url)

java.lang.Object GroovyScriptEngine(java.lang.String url, java.lang.ClassLoader parentClassLoader)

java.lang.Object GroovyScriptEngine(ResourceConnector rc)

java.lang.Object GroovyScriptEngine(ResourceConnector rc, java.lang.ClassLoader parentClassLoader)

Script createScript(java.lang.String scriptName, Binding binding)

CompilerConfiguration getConfig()

protected long getCurrentTime()

GroovyClassLoader getGroovyClassLoader()

Returns the GroovyClassLoader associated with this script engine instance.

java.lang.ClassLoader getParentClassLoader()

java.net.URLConnection getResourceConnection(java.lang.String resourceName)

protected boolean isSourceNewer(GroovyScriptEngine.ScriptCacheEntry entry)

java.lang.Class loadScriptByName(java.lang.String scriptName)

static void main(java.lang.String[] urls)

java.lang.String run(java.lang.String scriptName, java.lang.String argument)

Run a script identified by name with a given binding.

java.lang.Object run(java.lang.String scriptName, Binding binding)

void setConfig(CompilerConfiguration config)

 
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()
 

Method Detail

GroovyScriptEngine

public java.lang.Object GroovyScriptEngine(java.net.URL[] roots)


GroovyScriptEngine

public java.lang.Object GroovyScriptEngine(java.net.URL[] roots, java.lang.ClassLoader parentClassLoader)


GroovyScriptEngine

public java.lang.Object GroovyScriptEngine(java.lang.String[] urls)


GroovyScriptEngine

public java.lang.Object GroovyScriptEngine(java.lang.String[] urls, java.lang.ClassLoader parentClassLoader)


GroovyScriptEngine

public java.lang.Object GroovyScriptEngine(java.lang.String url)


GroovyScriptEngine

public java.lang.Object GroovyScriptEngine(java.lang.String url, java.lang.ClassLoader parentClassLoader)


GroovyScriptEngine

public java.lang.Object GroovyScriptEngine(ResourceConnector rc)


GroovyScriptEngine

public java.lang.Object GroovyScriptEngine(ResourceConnector rc, java.lang.ClassLoader parentClassLoader)


createScript

public Script createScript(java.lang.String scriptName, Binding binding)


getConfig

public CompilerConfiguration getConfig()


getCurrentTime

protected long getCurrentTime()


getGroovyClassLoader

public GroovyClassLoader getGroovyClassLoader()
Returns the GroovyClassLoader associated with this script engine instance. Useful if you need to pass the class loader to another library.
Returns:
the GroovyClassLoader


getParentClassLoader

public java.lang.ClassLoader getParentClassLoader()


getResourceConnection

public java.net.URLConnection getResourceConnection(java.lang.String resourceName)


isSourceNewer

protected boolean isSourceNewer(GroovyScriptEngine.ScriptCacheEntry entry)


loadScriptByName

public java.lang.Class loadScriptByName(java.lang.String scriptName)


main

public static void main(java.lang.String[] urls)


run

public java.lang.String run(java.lang.String scriptName, java.lang.String argument)
Run a script identified by name with a given binding.
throws:
ResourceException if there is a problem accessing the script
throws:
ScriptException if there is a problem parsing the script
Parameters:
scriptName - name of the script to run
binding - the binding to pass to the script
Returns:
an object


run

public java.lang.Object run(java.lang.String scriptName, Binding binding)


setConfig

public void setConfig(CompilerConfiguration config)


 

Groovy Documentation