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 classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final AviatorEvaluatorInstanceprivate final AviatorScriptEngineFactoryprivate final AviatorScriptEngine.DynamicFunctionInvocationHandlerprivate static final intstatic final ThreadLocal<VarNameGenerator> Fields inherited from class AbstractScriptEngine
contextFields inherited from interface 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 StringgenVar()getCachingKey(String script) <T> TgetInterface(Class<T> clasz) <T> TgetInterface(Object thiz, Class<T> clasz) invokeFunction(String name, Object... args) private ObjectinvokeFunction(String name, Bindings bindings, Object... args) invokeMethod(Object thiz, String name, Object... args) booleanisCached()voidsetCached(boolean cached) Setting whether to cache the compiled script, default is true(caching).Methods inherited from class 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:
invokeMethodin interfaceInvocable- Throws:
ScriptExceptionNoSuchMethodException
-
getEngine
-
genVar
-
invokeFunction
public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException - Specified by:
invokeFunctionin interfaceInvocable- Throws:
ScriptExceptionNoSuchMethodException
-
invokeFunction
private Object invokeFunction(String name, Bindings bindings, Object... args) throws ScriptException - Throws:
ScriptException
-
getInterface
- Specified by:
getInterfacein interfaceInvocable
-
getInterface
- Specified by:
getInterfacein interfaceInvocable
-
compile
- Specified by:
compilein interfaceCompilable- Throws:
ScriptException
-
getCachingKey
-
compile
- Specified by:
compilein interfaceCompilable- Throws:
ScriptException
-
createBindings
-
createBindings
- Specified by:
createBindingsin interfaceScriptEngine
-
eval
- Specified by:
evalin interfaceScriptEngine- Throws:
ScriptException
-
eval
- Specified by:
evalin interfaceScriptEngine- Throws:
ScriptException
-
getFactory
- Specified by:
getFactoryin 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.
-