类 StandardScriptEvaluator
java.lang.Object
cn.taketoday.scripting.support.StandardScriptEvaluator
- 所有已实现的接口:
Aware,BeanClassLoaderAware,ScriptEvaluator
public class StandardScriptEvaluator
extends Object
implements ScriptEvaluator, BeanClassLoaderAware
javax.script (JSR-223) based implementation of Framework's ScriptEvaluator
strategy interface.- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Costin Leau
- 另请参阅:
-
构造器概要
构造器构造器说明Construct a newStandardScriptEvaluator.StandardScriptEvaluator(ClassLoader classLoader) Construct a newStandardScriptEvaluatorfor the given class loader.StandardScriptEvaluator(ScriptEngineManager scriptEngineManager) Construct a newStandardScriptEvaluatorfor the given JSR-223ScriptEngineManagerto obtain script engines from. -
方法概要
修饰符和类型方法说明evaluate(ScriptSource script) Evaluate the given script.evaluate(ScriptSource script, Map<String, Object> argumentBindings) Evaluate the given script with the given arguments.protected ScriptEnginegetScriptEngine(ScriptSource script) Obtain the JSR-223 ScriptEngine to use for the given script.voidsetBeanClassLoader(ClassLoader classLoader) voidsetEngineName(String engineName) Set the name of the script engine for evaluating the scripts (e.g.voidsetGlobalBindings(Map<String, Object> globalBindings) Set the globally scoped bindings on the underlying script engine manager, shared by all scripts, as an alternative to script argument bindings.voidsetLanguage(String language) Set the name of the language meant for evaluating the scripts (e.g.
-
构造器详细资料
-
StandardScriptEvaluator
public StandardScriptEvaluator()Construct a newStandardScriptEvaluator. -
StandardScriptEvaluator
Construct a newStandardScriptEvaluatorfor the given class loader.- 参数:
classLoader- the class loader to use for script engine detection
-
StandardScriptEvaluator
Construct a newStandardScriptEvaluatorfor the given JSR-223ScriptEngineManagerto obtain script engines from.- 参数:
scriptEngineManager- the ScriptEngineManager (or subclass thereof) to use
-
-
方法详细资料
-
setLanguage
Set the name of the language meant for evaluating the scripts (e.g. "Groovy").This is effectively an alias for
"engineName", potentially (but not yet) providing common abbreviations for certain languages beyond what the JSR-223 script engine factory exposes. -
setEngineName
Set the name of the script engine for evaluating the scripts (e.g. "Groovy"), as exposed by the JSR-223 script engine factory. -
setGlobalBindings
Set the globally scoped bindings on the underlying script engine manager, shared by all scripts, as an alternative to script argument bindings. -
setBeanClassLoader
- 指定者:
setBeanClassLoader在接口中BeanClassLoaderAware
-
evaluate
从接口复制的说明:ScriptEvaluatorEvaluate the given script.- 指定者:
evaluate在接口中ScriptEvaluator- 参数:
script- the ScriptSource for the script to evaluate- 返回:
- the return value of the script, if any
-
evaluate
@Nullable public Object evaluate(ScriptSource script, @Nullable Map<String, Object> argumentBindings) 从接口复制的说明:ScriptEvaluatorEvaluate the given script with the given arguments.- 指定者:
evaluate在接口中ScriptEvaluator- 参数:
script- the ScriptSource for the script to evaluateargumentBindings- the key-value pairs to expose to the script, typically as script variables (may benullor empty)- 返回:
- the return value of the script, if any
-
getScriptEngine
Obtain the JSR-223 ScriptEngine to use for the given script.- 参数:
script- the script to evaluate- 返回:
- the ScriptEngine (never
null)
-