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 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.
  • Method Summary

    Modifier and Type Method 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.

    Methods inherited from class org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor

    getBeanClassLoader, getBeanFactory, getScriptVariableGenerator, processMessage, setBeanClassLoader, setBeanFactory

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GroovyScriptExecutingMessageProcessor

      public GroovyScriptExecutingMessageProcessor​(org.springframework.scripting.ScriptSource scriptSource)
      Create a processor for the given ScriptSource that 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 given ScriptSource that 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 a GroovyObjectCustomizer for this processor.
      Parameters:
      customizer - The customizer.
    • setCompileStatic

      public 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.

      More compiler options can be provided via setCompilerConfiguration(CompilerConfiguration) overriding this flag.

      Parameters:
      compileStatic - the compile static boolean flag.
      Since:
      4.3
      See Also:
      CompileStatic
    • setCompilerConfiguration

      public void setCompilerConfiguration​(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration)
      Specify the CompilerConfiguration options to customize the Groovy script compilation. For example the CompileStatic and ImportCustomizer are 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:
      getScriptSource in class org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.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:
      executeScript in class org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<java.lang.Object>