|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.common.annotation.AbstractMessageHandler
public abstract class AbstractMessageHandler
Abstract superclass for annotation based Message handlers. Handlers can be compared with on another to decide upon their priority. Handlers that deal with unrelated payloads (i.e. have no parent-child relationship) are ordered based on their payload type's class name.
Handler invokers should always evaluate the first (smallest) suitable handler before evaluating the next.
Constructor Summary | |
---|---|
protected |
AbstractMessageHandler(AbstractMessageHandler delegate)
Constructor used for implementations that delegate activity to another handler. |
protected |
AbstractMessageHandler(Class<?> payloadType,
Class<?> declaringClass,
ParameterResolver... parameterValueResolvers)
Initializes the MessageHandler to handle messages with the given payloadType , declared in the given
declaringClass and using the given parameterValueResolvers . |
Method Summary | ||
---|---|---|
int |
compareTo(AbstractMessageHandler o)
|
|
boolean |
equals(Object obj)
|
|
protected static ParameterResolver[] |
findResolvers(ParameterResolverFactory parameterResolverFactory,
Annotation[] memberAnnotations,
Class<?>[] parameterTypes,
Annotation[][] parameterAnnotations,
boolean resolvePayload)
Finds ParameterResolvers for the given Member details. |
|
abstract
|
getAnnotation(Class<T> annotationType)
Returns the member-level annotation of given annotationType , or null if no such
annotation is present. |
|
protected ParameterResolver[] |
getParameterValueResolvers()
Returns the parameter resolvers provided at construction time. |
|
Class |
getPayloadType()
Returns the type of payload this handler expects. |
|
int |
hashCode()
|
|
abstract Object |
invoke(Object target,
Message message)
Invokes this handler for the given target instance, using the given message as
source object to provide parameter values. |
|
boolean |
matches(Message message)
Indicates whether this Handler is suitable for the given message . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractMessageHandler(Class<?> payloadType, Class<?> declaringClass, ParameterResolver... parameterValueResolvers)
payloadType
, declared in the given
declaringClass
and using the given parameterValueResolvers
.
payloadType
- The type of payload this handlers deals withdeclaringClass
- The class on which the handler is declaredparameterValueResolvers
- The resolvers for each of the handlers' parametersprotected AbstractMessageHandler(AbstractMessageHandler delegate)
delegate
- The handler to which actual invocations are being forwardedMethod Detail |
---|
public boolean matches(Message message)
message
.
message
- The message to inspect
true
if this handler can handle the message, otherwise false
.public abstract Object invoke(Object target, Message message) throws InvocationTargetException, IllegalAccessException
target
instance, using the given message
as
source object to provide parameter values.
target
- The target instance to invoke the Handler on.message
- The message providing parameter values
InvocationTargetException
- when the handler throws a checked exception
IllegalAccessException
- if the SecurityManager refuses the handler invocationpublic Class getPayloadType()
public int compareTo(AbstractMessageHandler o)
compareTo
in interface Comparable<AbstractMessageHandler>
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
protected static ParameterResolver[] findResolvers(ParameterResolverFactory parameterResolverFactory, Annotation[] memberAnnotations, Class<?>[] parameterTypes, Annotation[][] parameterAnnotations, boolean resolvePayload)
parameterTypes
, where each ParameterResolver corresponds with the parameter type at the same
location.
parameterResolverFactory
- The factory to create the ParameterResolvers withmemberAnnotations
- The annotations on the member (e.g. method)parameterTypes
- The parameter type of the memberparameterAnnotations
- The annotations on each of the parametersresolvePayload
- Indicates whether the payload of the message should be resolved from the
parameters
Method
,
Constructor
protected ParameterResolver[] getParameterValueResolvers()
public abstract <T extends Annotation> T getAnnotation(Class<T> annotationType)
annotationType
, or null
if no such
annotation is present.
T
- The type of annotation to retrieveannotationType
- The type of annotation to retrieve
null
if no such annotation is present.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |