org.codehaus.groovy.jsr223
Class GroovyScriptEngineImpl

java.lang.Object
  extended by javax.script.AbstractScriptEngine
      extended by org.codehaus.groovy.jsr223.GroovyScriptEngineImpl
All Implemented Interfaces:
javax.script.Compilable, javax.script.Invocable, javax.script.ScriptEngine

public class GroovyScriptEngineImpl
extends javax.script.AbstractScriptEngine
implements javax.script.Compilable, javax.script.Invocable


Field Summary
private  java.util.Map<java.lang.String,java.lang.Class> classMap
           
private static int counter
           
private static boolean DEBUG
           
private  GroovyScriptEngineFactory factory
           
private  java.util.Map<java.lang.String,Closure> globalClosures
           
private  GroovyClassLoader loader
           
 
Fields inherited from class javax.script.AbstractScriptEngine
context
 
Fields inherited from interface javax.script.ScriptEngine
ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME
 
Constructor Summary
GroovyScriptEngineImpl()
           
 
Method Summary
private  java.lang.Object callGlobal(java.lang.String name, java.lang.Object[] args)
           
private  java.lang.Object callGlobal(java.lang.String name, java.lang.Object[] args, javax.script.ScriptContext ctx)
           
 javax.script.CompiledScript compile(java.io.Reader reader)
           
 javax.script.CompiledScript compile(java.lang.String scriptSource)
           
 javax.script.Bindings createBindings()
           
(package private)  java.lang.Object eval(java.lang.Class scriptClass, javax.script.ScriptContext ctx)
           
 java.lang.Object eval(java.io.Reader reader, javax.script.ScriptContext ctx)
           
 java.lang.Object eval(java.lang.String script, javax.script.ScriptContext ctx)
           
private  java.lang.String generateScriptName()
           
 javax.script.ScriptEngineFactory getFactory()
           
<T> T
getInterface(java.lang.Class<T> clasz)
           
<T> T
getInterface(java.lang.Object thiz, java.lang.Class<T> clasz)
           
private  java.lang.ClassLoader getParentLoader()
           
(package private)  java.lang.Class getScriptClass(java.lang.String script)
           
 java.lang.Object invokeFunction(java.lang.String name, java.lang.Object... args)
           
private  java.lang.Object invokeImpl(java.lang.Object thiz, java.lang.String name, java.lang.Object... args)
           
 java.lang.Object invokeMethod(java.lang.Object thiz, java.lang.String name, java.lang.Object... args)
           
private
<T> T
makeInterface(java.lang.Object obj, java.lang.Class<T> clazz)
           
private  java.lang.String readFully(java.io.Reader reader)
           
 
Methods inherited from class javax.script.AbstractScriptEngine
eval, eval, eval, eval, get, getBindings, getContext, getScriptContext, put, setBindings, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static boolean DEBUG

classMap

private java.util.Map<java.lang.String,java.lang.Class> classMap

globalClosures

private java.util.Map<java.lang.String,Closure> globalClosures

loader

private GroovyClassLoader loader

factory

private volatile GroovyScriptEngineFactory factory

counter

private static int counter
Constructor Detail

GroovyScriptEngineImpl

public GroovyScriptEngineImpl()
Method Detail

eval

public java.lang.Object eval(java.io.Reader reader,
                             javax.script.ScriptContext ctx)
                      throws javax.script.ScriptException
Specified by:
eval in interface javax.script.ScriptEngine
Throws:
javax.script.ScriptException

eval

public java.lang.Object eval(java.lang.String script,
                             javax.script.ScriptContext ctx)
                      throws javax.script.ScriptException
Specified by:
eval in interface javax.script.ScriptEngine
Throws:
javax.script.ScriptException

createBindings

public javax.script.Bindings createBindings()
Specified by:
createBindings in interface javax.script.ScriptEngine

getFactory

public javax.script.ScriptEngineFactory getFactory()
Specified by:
getFactory in interface javax.script.ScriptEngine

compile

public javax.script.CompiledScript compile(java.lang.String scriptSource)
                                    throws javax.script.ScriptException
Specified by:
compile in interface javax.script.Compilable
Throws:
javax.script.ScriptException

compile

public javax.script.CompiledScript compile(java.io.Reader reader)
                                    throws javax.script.ScriptException
Specified by:
compile in interface javax.script.Compilable
Throws:
javax.script.ScriptException

invokeFunction

public java.lang.Object invokeFunction(java.lang.String name,
                                       java.lang.Object... args)
                                throws javax.script.ScriptException,
                                       java.lang.NoSuchMethodException
Specified by:
invokeFunction in interface javax.script.Invocable
Throws:
javax.script.ScriptException
java.lang.NoSuchMethodException

invokeMethod

public java.lang.Object invokeMethod(java.lang.Object thiz,
                                     java.lang.String name,
                                     java.lang.Object... args)
                              throws javax.script.ScriptException,
                                     java.lang.NoSuchMethodException
Specified by:
invokeMethod in interface javax.script.Invocable
Throws:
javax.script.ScriptException
java.lang.NoSuchMethodException

getInterface

public <T> T getInterface(java.lang.Class<T> clasz)
Specified by:
getInterface in interface javax.script.Invocable

getInterface

public <T> T getInterface(java.lang.Object thiz,
                          java.lang.Class<T> clasz)
Specified by:
getInterface in interface javax.script.Invocable

eval

java.lang.Object eval(java.lang.Class scriptClass,
                      javax.script.ScriptContext ctx)
                throws javax.script.ScriptException
Throws:
javax.script.ScriptException

getScriptClass

java.lang.Class getScriptClass(java.lang.String script)
                         throws SyntaxException,
                                CompilationFailedException,
                                java.io.IOException
Throws:
SyntaxException
CompilationFailedException
java.io.IOException

invokeImpl

private java.lang.Object invokeImpl(java.lang.Object thiz,
                                    java.lang.String name,
                                    java.lang.Object... args)
                             throws javax.script.ScriptException,
                                    java.lang.NoSuchMethodException
Throws:
javax.script.ScriptException
java.lang.NoSuchMethodException

callGlobal

private java.lang.Object callGlobal(java.lang.String name,
                                    java.lang.Object[] args)

callGlobal

private java.lang.Object callGlobal(java.lang.String name,
                                    java.lang.Object[] args,
                                    javax.script.ScriptContext ctx)

generateScriptName

private java.lang.String generateScriptName()

makeInterface

private <T> T makeInterface(java.lang.Object obj,
                            java.lang.Class<T> clazz)

getParentLoader

private java.lang.ClassLoader getParentLoader()

readFully

private java.lang.String readFully(java.io.Reader reader)
                            throws javax.script.ScriptException
Throws:
javax.script.ScriptException


Copyright © ${year} The Codehaus. All Rights Reserved.