类 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'sScriptEvaluator
strategy interface.- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller
- 另请参阅:
GroovyShell.evaluate(String, String)
构造器概要
构造器 构造器 说明 GroovyScriptEvaluator()
Construct a new GroovyScriptEvaluator.GroovyScriptEvaluator(ClassLoader classLoader)
Construct a new GroovyScriptEvaluator.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Object
evaluate(ScriptSource script)
Evaluate the given script.Object
evaluate(ScriptSource script, Map<String,Object> arguments)
Evaluate the given script with the given arguments.org.codehaus.groovy.control.CompilerConfiguration
getCompilerConfiguration()
Return this evaluator's compiler configuration (nevernull
).void
setBeanClassLoader(ClassLoader classLoader)
Callback that supplies the beanclass loader
to a bean instance.void
setCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer... compilationCustomizers)
Set one or more customizers to be applied to this evaluator's compiler configuration.void
setCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)
Set a custom compiler configuration for this evaluator.
构造器详细资料
GroovyScriptEvaluator
public GroovyScriptEvaluator()
Construct a new GroovyScriptEvaluator.
GroovyScriptEvaluator
public GroovyScriptEvaluator(@Nullable ClassLoader classLoader)
Construct a new GroovyScriptEvaluator.- 参数:
classLoader
- the ClassLoader to use as a parent for theGroovyShell
方法详细资料
setCompilerConfiguration
public void setCompilerConfiguration(@Nullable 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)
从接口复制的说明:BeanClassLoaderAware
Callback that supplies the beanclass loader
to a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean's
InitializingBean.afterPropertiesSet()
method or a custom init-method.- 指定者:
setBeanClassLoader
在接口中BeanClassLoaderAware
- 参数:
classLoader
- the owning class loader
evaluate
@Nullable public Object evaluate(ScriptSource script)
从接口复制的说明:ScriptEvaluator
Evaluate 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> arguments)
从接口复制的说明:ScriptEvaluator
Evaluate 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 benull
or empty)- 返回:
- the return value of the script, if any