public class GroovyScriptEvaluator extends Object implements ScriptEvaluator, BeanClassLoaderAware
ScriptEvaluator
strategy interface.GroovyShell.evaluate(String, String)
Constructor and Description |
---|
GroovyScriptEvaluator()
Construct a new GroovyScriptEvaluator.
|
GroovyScriptEvaluator(ClassLoader classLoader)
Construct a new GroovyScriptEvaluator.
|
Modifier and Type | Method and Description |
---|---|
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 (never
null ). |
void |
setBeanClassLoader(ClassLoader classLoader)
Callback that supplies the bean
class 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.
|
public GroovyScriptEvaluator()
public GroovyScriptEvaluator(@Nullable ClassLoader classLoader)
classLoader
- the ClassLoader to use as a parent for the GroovyShell
public void setCompilerConfiguration(@Nullable org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)
setCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer...)
public org.codehaus.groovy.control.CompilerConfiguration getCompilerConfiguration()
null
).setCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration)
public void setCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer... compilationCustomizers)
Note that this modifies the shared compiler configuration held by this evaluator.
setCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration)
public void setBeanClassLoader(ClassLoader classLoader)
BeanClassLoaderAware
class 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
in interface BeanClassLoaderAware
classLoader
- the owning class loader@Nullable public Object evaluate(ScriptSource script)
ScriptEvaluator
evaluate
in interface ScriptEvaluator
script
- the ScriptSource for the script to evaluate@Nullable public Object evaluate(ScriptSource script, @Nullable Map<String,Object> arguments)
ScriptEvaluator
evaluate
in interface ScriptEvaluator
script
- the ScriptSource for the script to evaluatearguments
- the key-value pairs to expose to the script,
typically as script variables (may be null
or empty)