Class GroovyScriptExecutingMessageProcessor
java.lang.Object
org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>
org.springframework.integration.groovy.GroovyScriptExecutingMessageProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.InitializingBean,org.springframework.integration.handler.MessageProcessor<java.lang.Object>
public class GroovyScriptExecutingMessageProcessor
extends org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>
implements org.springframework.beans.factory.InitializingBean
The
MessageProcessor implementation
to evaluate Groovy scripts.- Since:
- 2.0
-
Constructor Summary
Constructors Constructor Description GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource)Create a processor for the givenScriptSourcethat will use a DefaultScriptVariableGenerator.GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource, org.springframework.integration.scripting.ScriptVariableGenerator scriptVariableGenerator)Create a processor for the givenScriptSourcethat will use the provided ScriptVariableGenerator. -
Method Summary
Modifier and Type Method Description voidafterPropertiesSet()protected java.lang.ObjectexecuteScript(org.springframework.scripting.ScriptSource scriptSource, java.util.Map<java.lang.String,java.lang.Object> variables)protected org.springframework.scripting.ScriptSourcegetScriptSource(org.springframework.messaging.Message<?> message)voidsetCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)Specify theCompilerConfigurationoptions to customize the Groovy script compilation.voidsetCompileStatic(boolean compileStatic)Specify thebooleanflag to indicate if theGroovyClassLoader's compiler should be customised for theCompileStatichint for the provided script.voidsetCustomizer(org.springframework.scripting.groovy.GroovyObjectCustomizer customizer)Sets aGroovyObjectCustomizerfor this processor.
-
Constructor Details
-
GroovyScriptExecutingMessageProcessor
public GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource)Create a processor for the givenScriptSourcethat will use a DefaultScriptVariableGenerator.- Parameters:
scriptSource- The script source.
-
GroovyScriptExecutingMessageProcessor
public GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource, org.springframework.integration.scripting.ScriptVariableGenerator scriptVariableGenerator)Create a processor for the givenScriptSourcethat will use the provided ScriptVariableGenerator.- Parameters:
scriptSource- The script source.scriptVariableGenerator- The variable generator.
-
-
Method Details
-
setCustomizer
public void setCustomizer(org.springframework.scripting.groovy.GroovyObjectCustomizer customizer)Sets aGroovyObjectCustomizerfor this processor.- Parameters:
customizer- The customizer.
-
setCompileStatic
public void setCompileStatic(boolean compileStatic)Specify thebooleanflag to indicate if theGroovyClassLoader's compiler should be customised for theCompileStatichint for the provided script.More compiler options can be provided via
setCompilerConfiguration(CompilerConfiguration)overriding this flag.- Parameters:
compileStatic- the compile staticbooleanflag.- Since:
- 4.3
- See Also:
CompileStatic
-
setCompilerConfiguration
public void setCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)Specify theCompilerConfigurationoptions to customize the Groovy script compilation. For example theCompileStaticandImportCustomizerare the most popular options.- Parameters:
compilerConfiguration- the Groovy script compiler options to use.- Since:
- 4.3
- See Also:
CompileStatic,GroovyClassLoader
-
getScriptSource
protected org.springframework.scripting.ScriptSource getScriptSource(org.springframework.messaging.Message<?> message)- Specified by:
getScriptSourcein classorg.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
executeScript
protected java.lang.Object executeScript(org.springframework.scripting.ScriptSource scriptSource, java.util.Map<java.lang.String,java.lang.Object> variables)- Specified by:
executeScriptin classorg.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>
-