public class GroovyScriptExecutingMessageProcessor extends AbstractScriptExecutingMessageProcessor<Object> implements InitializingBean
MessageProcessor
implementation
to evaluate Groovy scripts.Constructor and Description |
---|
GroovyScriptExecutingMessageProcessor(ScriptSource scriptSource)
Create a processor for the given
ScriptSource that will use a
DefaultScriptVariableGenerator. |
GroovyScriptExecutingMessageProcessor(ScriptSource scriptSource,
ScriptVariableGenerator scriptVariableGenerator)
Create a processor for the given
ScriptSource that will use the provided
ScriptVariableGenerator. |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected Object |
executeScript(ScriptSource scriptSource,
Map<String,Object> variables)
Subclasses must implement this method.
|
protected ScriptSource |
getScriptSource(Message<?> message)
Subclasses must implement this method to create a script source,
optionally using the message to locate or create the script.
|
void |
setCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)
Specify the
CompilerConfiguration options to customize the Groovy script compilation. |
void |
setCompileStatic(boolean compileStatic)
Specify the
boolean flag to indicate if the GroovyClassLoader 's compiler
should be customised for the CompileStatic hint for the provided script. |
void |
setCustomizer(GroovyObjectCustomizer customizer)
Sets a
GroovyObjectCustomizer for this processor. |
getBeanClassLoader, getBeanFactory, getScriptVariableGenerator, processMessage, setBeanClassLoader, setBeanFactory
public GroovyScriptExecutingMessageProcessor(ScriptSource scriptSource)
ScriptSource
that will use a
DefaultScriptVariableGenerator.scriptSource
- The script source.public GroovyScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptVariableGenerator scriptVariableGenerator)
ScriptSource
that will use the provided
ScriptVariableGenerator.scriptSource
- The script source.scriptVariableGenerator
- The variable generator.public void setCustomizer(GroovyObjectCustomizer customizer)
GroovyObjectCustomizer
for this processor.customizer
- The customizer.public void setCompileStatic(boolean compileStatic)
boolean
flag to indicate if the GroovyClassLoader
's compiler
should be customised for the CompileStatic
hint for the provided script.
More compiler options can be provided via setCompilerConfiguration(CompilerConfiguration)
overriding this flag.
compileStatic
- the compile static boolean
flag.CompileStatic
public void setCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)
CompilerConfiguration
options to customize the Groovy script compilation.
For example the CompileStatic
and ImportCustomizer
are the most popular options.compilerConfiguration
- the Groovy script compiler options to use.CompileStatic
,
GroovyClassLoader
protected ScriptSource getScriptSource(Message<?> message)
AbstractScriptExecutingMessageProcessor
getScriptSource
in class AbstractScriptExecutingMessageProcessor<Object>
message
- the message being processedpublic void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
protected Object executeScript(ScriptSource scriptSource, Map<String,Object> variables)
AbstractScriptExecutingMessageProcessor
executeScript
in class AbstractScriptExecutingMessageProcessor<Object>
scriptSource
- The script source.variables
- The variables.