public final class MessageHandlerInvoker extends Object
| Constructor and Description |
|---|
MessageHandlerInvoker(Object target,
Class<? extends Annotation> annotationType,
boolean allowDuplicates)
Initialize a handler invoker for the given
target object that has handler method annotated with
given annotationType. |
| Modifier and Type | Method and Description |
|---|---|
MethodMessageHandler |
findHandlerMethod(Message message)
Finds the handler method that can handle the given
message, or null if no such handler
exists. |
Class |
getTargetType()
Returns the targetType on which handler methods are invoked.
|
Object |
invokeHandlerMethod(Message parameter)
Invoke the handler demarcated with the given
annotationClass on the target for the given
event. |
public MessageHandlerInvoker(Object target, Class<? extends Annotation> annotationType, boolean allowDuplicates)
target object that has handler method annotated with
given annotationType.target - The target to invoke methods onannotationType - The type of annotation used to demarcate the handler methodsallowDuplicates - Whether or not to accept multiple handlers listening to messages with the same payload
typepublic Object invokeHandlerMethod(Message parameter) throws InvocationTargetException, IllegalAccessException
annotationClass on the target for the given
event. Returns the result of the execution of the handler method, or null if no
suitable handler was found.parameter - the event to handleIllegalAccessException - when the security manager does not allow the invocationInvocationTargetException - when the handler throws a checked Exceptionpublic MethodMessageHandler findHandlerMethod(Message message)
message, or null if no such handler
exists.message - The message to find a handler fornull if none existspublic Class getTargetType()
Copyright © 2010-2013. All Rights Reserved.