public class GroovyScriptEvaluator extends java.lang.Object implements ScriptEvaluator, org.springframework.beans.factory.BeanClassLoaderAware
ScriptEvaluator
strategy interface.GroovyShell.evaluate(String, String)
Constructor and Description |
---|
GroovyScriptEvaluator()
Construct a new GroovyScriptEvaluator.
|
GroovyScriptEvaluator(java.lang.ClassLoader classLoader)
Construct a new GroovyScriptEvaluator.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
evaluate(ScriptSource script)
Evaluate the given script.
|
java.lang.Object |
evaluate(ScriptSource script,
java.util.Map<java.lang.String,java.lang.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(java.lang.ClassLoader classLoader) |
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(java.lang.ClassLoader classLoader)
classLoader
- the ClassLoader to use as a parent for the GroovyShell
public void setCompilerConfiguration(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(java.lang.ClassLoader classLoader)
setBeanClassLoader
in interface org.springframework.beans.factory.BeanClassLoaderAware
public java.lang.Object evaluate(ScriptSource script)
ScriptEvaluator
evaluate
in interface ScriptEvaluator
script
- the ScriptSource for the script to evaluatepublic java.lang.Object evaluate(ScriptSource script, java.util.Map<java.lang.String,java.lang.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)