类 GroovyScriptEvaluator
- java.lang.Object
- org.springframework.scripting.groovy.GroovyScriptEvaluator
- 所有已实现的接口:
Aware,BeanClassLoaderAware,ScriptEvaluator
public class GroovyScriptEvaluator extends Object implements ScriptEvaluator, BeanClassLoaderAware
Groovy-based implementation of Spring'sScriptEvaluatorstrategy interface.- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller
- 另请参阅:
GroovyShell.evaluate(String, String)
构造器概要
构造器 构造器 说明 GroovyScriptEvaluator()Construct a new GroovyScriptEvaluator.GroovyScriptEvaluator(ClassLoader classLoader)Construct a new GroovyScriptEvaluator.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Objectevaluate(ScriptSource script)Evaluate the given script.Objectevaluate(ScriptSource script, Map<String,Object> arguments)Evaluate the given script with the given arguments.org.codehaus.groovy.control.CompilerConfigurationgetCompilerConfiguration()Return this evaluator's compiler configuration (nevernull).voidsetBeanClassLoader(ClassLoader classLoader)Callback that supplies the beanclass loaderto a bean instance.voidsetCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer... compilationCustomizers)Set one or more customizers to be applied to this evaluator's compiler configuration.voidsetCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)Set a custom compiler configuration for this evaluator.
构造器详细资料
GroovyScriptEvaluator
public GroovyScriptEvaluator()
Construct a new GroovyScriptEvaluator.
GroovyScriptEvaluator
public GroovyScriptEvaluator(ClassLoader classLoader)
Construct a new GroovyScriptEvaluator.- 参数:
classLoader- the ClassLoader to use as a parent for theGroovyShell
方法详细资料
setCompilerConfiguration
public void setCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)
Set a custom compiler configuration for this evaluator.
getCompilerConfiguration
public org.codehaus.groovy.control.CompilerConfiguration getCompilerConfiguration()
Return this evaluator's compiler configuration (nevernull).
setCompilationCustomizers
public void setCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer... compilationCustomizers)
Set one or more customizers to be applied to this evaluator's compiler configuration.Note that this modifies the shared compiler configuration held by this evaluator.
setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)
从接口复制的说明:BeanClassLoaderAwareCallback that supplies the beanclass loaderto a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean'sInitializingBean.afterPropertiesSet()method or a custom init-method.- 指定者:
setBeanClassLoader在接口中BeanClassLoaderAware- 参数:
classLoader- the owning class loader; may benullin which case a defaultClassLoadermust be used, for example theClassLoaderobtained viaClassUtils.getDefaultClassLoader()
evaluate
public Object evaluate(ScriptSource script)
从接口复制的说明:ScriptEvaluatorEvaluate the given script.- 指定者:
evaluate在接口中ScriptEvaluator- 参数:
script- the ScriptSource for the script to evaluate- 返回:
- the return value of the script, if any
evaluate
public Object evaluate(ScriptSource script, Map<String,Object> arguments)
从接口复制的说明:ScriptEvaluatorEvaluate the given script with the given arguments.- 指定者:
evaluate在接口中ScriptEvaluator- 参数:
script- the ScriptSource for the script to evaluatearguments- the key-value pairs to expose to the script, typically as script variables (may benullor empty)- 返回:
- the return value of the script, if any