Package com.googlecode.aviator.script
Class AviatorScriptEngine
java.lang.Object
javax.script.AbstractScriptEngine
com.googlecode.aviator.script.AviatorScriptEngine
- All Implemented Interfaces:
Compilable
,Invocable
,ScriptEngine
Aviator script engine
- Version:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
private class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final AviatorEvaluatorInstance
private final AviatorScriptEngineFactory
private final AviatorScriptEngine.DynamicFunctionInvocationHandler
private static final int
static final ThreadLocal
<VarNameGenerator> 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
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptioncreateBindings
(Bindings parent) eval
(Reader reader, ScriptContext context) eval
(String script, ScriptContext context) private String
genVar()
getCachingKey
(String script) <T> T
getInterface
(Class<T> clasz) <T> T
getInterface
(Object thiz, Class<T> clasz) invokeFunction
(String name, Object... args) private Object
invokeFunction
(String name, Bindings bindings, Object... args) invokeMethod
(Object thiz, String name, Object... args) boolean
isCached()
void
setCached
(boolean cached) Setting whether to cache the compiled script, default is true(caching).Methods inherited from class javax.script.AbstractScriptEngine
eval, eval, eval, eval, get, getBindings, getContext, getScriptContext, put, setBindings, setContext
-
Field Details
-
KEY_THRESHOLD
private static final int KEY_THRESHOLD- See Also:
-
cached
private boolean cached -
factory
-
engine
-
TEMP_VAR_GEN
-
functionProxyHandler
-
-
Constructor Details
-
AviatorScriptEngine
public AviatorScriptEngine() -
AviatorScriptEngine
-
AviatorScriptEngine
-
-
Method Details
-
invokeMethod
public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException - Specified by:
invokeMethod
in interfaceInvocable
- Throws:
ScriptException
NoSuchMethodException
-
getEngine
-
genVar
-
invokeFunction
public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException - Specified by:
invokeFunction
in interfaceInvocable
- Throws:
ScriptException
NoSuchMethodException
-
invokeFunction
private Object invokeFunction(String name, Bindings bindings, Object... args) throws ScriptException - Throws:
ScriptException
-
getInterface
- Specified by:
getInterface
in interfaceInvocable
-
getInterface
- Specified by:
getInterface
in interfaceInvocable
-
compile
- Specified by:
compile
in interfaceCompilable
- Throws:
ScriptException
-
getCachingKey
-
compile
- Specified by:
compile
in interfaceCompilable
- Throws:
ScriptException
-
createBindings
-
createBindings
- Specified by:
createBindings
in interfaceScriptEngine
-
eval
- Specified by:
eval
in interfaceScriptEngine
- Throws:
ScriptException
-
eval
- Specified by:
eval
in interfaceScriptEngine
- Throws:
ScriptException
-
getFactory
- Specified by:
getFactory
in interfaceScriptEngine
-
isCached
public boolean isCached() -
setCached
public void setCached(boolean cached) Setting whether to cache the compiled script, default is true(caching).- Parameters:
cached
- true means enable caching.
-