public abstract class AbstractMessageHandler extends Object implements Comparable<AbstractMessageHandler>
Modifier | Constructor and Description |
---|---|
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 . |
Modifier and Type | Method and Description |
---|---|
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 <T extends Annotation> |
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 . |
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 forwardedpublic boolean matches(Message message)
message
.message
- The message to inspecttrue
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 valuesInvocationTargetException
- when the handler throws a checked exceptionIllegalAccessException
- if the SecurityManager refuses the handler invocationpublic Class getPayloadType()
public int compareTo(AbstractMessageHandler o)
compareTo
in interface Comparable<AbstractMessageHandler>
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
parametersMethod
,
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 retrievenull
if no such annotation is present.Copyright © 2010-2014. All Rights Reserved.