Class MessagingMethodInvokerHelper
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.handler.support.MessagingMethodInvokerHelper
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.Lifecycle
,ManageableLifecycle
public class MessagingMethodInvokerHelper extends AbstractExpressionEvaluator implements ManageableLifecycle
A helper class for processors that invoke a method on a target Object using
a combination of message payload(s) and headers as arguments.
The Method instance or method name may be provided as a constructor argument.
If a method name is provided, and more than one declared method has that name,
the method-selection will be dynamic, based on the underlying SpEL method resolution.
Alternatively, an annotation type may be provided so that the candidates for SpEL's
method resolution are determined by the presence of that annotation rather than the method name.
- Since:
- 2.0
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessagingMethodInvokerHelper.ParametersWrapper
-
Field Summary
Fields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, boolean canProcessMessageList)
MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.Class<?> expectedType, boolean canProcessMessageList)
MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.reflect.Method method, boolean canProcessMessageList)
MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.reflect.Method method, java.lang.Class<?> expectedType, boolean canProcessMessageList)
MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.String methodName, boolean canProcessMessageList)
MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.String methodName, java.lang.Class<?> expectedType, boolean canProcessMessageList)
-
Method Summary
Modifier and Type Method Description boolean
isRunning()
java.lang.Object
process(java.util.Collection<org.springframework.messaging.Message<?>> messages, java.util.Map<java.lang.String,java.lang.Object> headers)
java.lang.Object
process(org.springframework.messaging.Message<?> message)
void
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Specify a BeanFactory in order to enable resolution via@beanName
in the expression.void
setUseSpelInvoker(boolean useSpelInvoker)
Aboolean
flag to use SpEL Expression evaluation orInvocableHandlerMethod
for target method invocation.void
start()
void
stop()
java.lang.String
toString()
Methods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, onInit, setConversionService
-
Constructor Details
-
MessagingMethodInvokerHelper
public MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.reflect.Method method, java.lang.Class<?> expectedType, boolean canProcessMessageList) -
MessagingMethodInvokerHelper
public MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.reflect.Method method, boolean canProcessMessageList) -
MessagingMethodInvokerHelper
public MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.String methodName, java.lang.Class<?> expectedType, boolean canProcessMessageList) -
MessagingMethodInvokerHelper
public MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.String methodName, boolean canProcessMessageList) -
MessagingMethodInvokerHelper
public MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, boolean canProcessMessageList) -
MessagingMethodInvokerHelper
public MessagingMethodInvokerHelper(java.lang.Object targetObject, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.Class<?> expectedType, boolean canProcessMessageList)
-
-
Method Details
-
setUseSpelInvoker
public void setUseSpelInvoker(boolean useSpelInvoker)Aboolean
flag to use SpEL Expression evaluation orInvocableHandlerMethod
for target method invocation.- Parameters:
useSpelInvoker
- to use SpEL Expression evaluation or not.- Since:
- 5.0
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)Description copied from class:AbstractExpressionEvaluator
Specify a BeanFactory in order to enable resolution via@beanName
in the expression.- Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Overrides:
setBeanFactory
in classAbstractExpressionEvaluator
-
process
@Nullable public java.lang.Object process(org.springframework.messaging.Message<?> message) -
process
@Nullable public java.lang.Object process(java.util.Collection<org.springframework.messaging.Message<?>> messages, java.util.Map<java.lang.String,java.lang.Object> headers) -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
start
public void start()- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
- Specified by:
start
in interfaceManageableLifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
- Specified by:
stop
in interfaceManageableLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
- Specified by:
isRunning
in interfaceManageableLifecycle
-