org.axonframework.common.annotation
Class AbstractAnnotatedHandlerDefinition<T extends Annotation>

java.lang.Object
  extended by org.axonframework.common.annotation.AbstractAnnotatedHandlerDefinition<T>
Type Parameters:
T - The type of annotation marking the members as handlers
All Implemented Interfaces:
HandlerDefinition<AccessibleObject>

public abstract class AbstractAnnotatedHandlerDefinition<T extends Annotation>
extends Object
implements HandlerDefinition<AccessibleObject>

Abstract implementation of the HandlerDefinition that uses annotations to recognise handler methods or constructors. Annotations may return Void.class when the payload type is undefined (as null is not allowed as a parameter value).

Since:
2.1
Author:
Allard Buijze

Constructor Summary
protected AbstractAnnotatedHandlerDefinition(Class<T> annotationType)
          Initialize the Definition, using where handlers are annotated with given annotationType.
 
Method Summary
protected abstract  Class<?> getDefinedPayload(T annotation)
          Returns the payload type configured on the given annotated method.
 boolean isMessageHandler(AccessibleObject member)
          Indicates whether the given member is to be considered a message handler
 Class<?> resolvePayloadFor(AccessibleObject member)
          Returns the explicitly defined payload of supported messages on the given member
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractAnnotatedHandlerDefinition

protected AbstractAnnotatedHandlerDefinition(Class<T> annotationType)
Initialize the Definition, using where handlers are annotated with given annotationType.

Parameters:
annotationType - The type of annotation that marks the handlers
Method Detail

isMessageHandler

public boolean isMessageHandler(AccessibleObject member)
Description copied from interface: HandlerDefinition
Indicates whether the given member is to be considered a message handler

Specified by:
isMessageHandler in interface HandlerDefinition<AccessibleObject>
Parameters:
member - The member to verify
Returns:
true if the given member is a message handler, otherwise false

resolvePayloadFor

public Class<?> resolvePayloadFor(AccessibleObject member)
Description copied from interface: HandlerDefinition
Returns the explicitly defined payload of supported messages on the given member

Specified by:
resolvePayloadFor in interface HandlerDefinition<AccessibleObject>
Parameters:
member - the member method
Returns:
the explicitly configured payload type, or null if the payload must be deducted from the handler's parameters

getDefinedPayload

protected abstract Class<?> getDefinedPayload(T annotation)
Returns the payload type configured on the given annotated method. A payload type of "Void" is considered to represent "no explicit payload configured" (as null values are not permitted on annotations).

Parameters:
annotation - The annotation that defines this method to be a handler
Returns:
the explicit payload type for this handler

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2016. All Rights Reserved.