public class GroovyScriptExecutingMessageProcessor
extends org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>
implements org.springframework.beans.factory.InitializingBean
MessageProcessor implementation
to evaluate Groovy scripts.| Constructor and Description |
|---|
GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource)
Create a processor for the given
ScriptSource that will use a
DefaultScriptVariableGenerator. |
GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource,
org.springframework.integration.scripting.ScriptVariableGenerator scriptVariableGenerator)
Create a processor for the given
ScriptSource that will use the provided
ScriptVariableGenerator. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected java.lang.Object |
executeScript(org.springframework.scripting.ScriptSource scriptSource,
java.util.Map<java.lang.String,java.lang.Object> variables) |
protected org.springframework.scripting.ScriptSource |
getScriptSource(org.springframework.messaging.Message<?> message) |
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(org.springframework.scripting.groovy.GroovyObjectCustomizer customizer)
Sets a
GroovyObjectCustomizer for this processor. |
public GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource)
ScriptSource that will use a
DefaultScriptVariableGenerator.scriptSource - The script source.public GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource,
org.springframework.integration.scripting.ScriptVariableGenerator scriptVariableGenerator)
ScriptSource that will use the provided
ScriptVariableGenerator.scriptSource - The script source.scriptVariableGenerator - The variable generator.public void setCustomizer(org.springframework.scripting.groovy.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.CompileStaticpublic 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,
GroovyClassLoaderprotected org.springframework.scripting.ScriptSource getScriptSource(org.springframework.messaging.Message<?> message)
getScriptSource in class org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionprotected java.lang.Object executeScript(org.springframework.scripting.ScriptSource scriptSource,
java.util.Map<java.lang.String,java.lang.Object> variables)
throws java.lang.Exception
executeScript in class org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>java.lang.Exception