org.axonframework.saga.annotation
Class SagaMethodMessageHandlerInspector<T extends AbstractAnnotatedSaga>

java.lang.Object
  extended by org.axonframework.saga.annotation.SagaMethodMessageHandlerInspector<T>
Type Parameters:
T - The type of saga targeted by this inspector

public class SagaMethodMessageHandlerInspector<T extends AbstractAnnotatedSaga>
extends Object

Utility class that inspects annotation on a Saga instance and returns the relevant configuration for its Event Handlers.

Since:
0.7
Author:
Allard Buijze

Constructor Summary
protected SagaMethodMessageHandlerInspector(Class<T> sagaType, ParameterResolverFactory parameterResolverFactory)
          Initialize the inspector to handle events for the given sagaType.
 
Method Summary
 SagaMethodMessageHandler findHandlerMethod(AbstractAnnotatedSaga target, EventMessage event)
          Finds the handler method on given target for the given event.
static
<T extends AbstractAnnotatedSaga>
SagaMethodMessageHandlerInspector<T>
getInstance(Class<T> sagaType, ParameterResolverFactory parameterResolverFactory)
          Returns a SagaMethodMessageHandlerInspector for the given sagaType.
 List<SagaMethodMessageHandler> getMessageHandlers(EventMessage event)
          Find the configuration for the handlers for the given event.
 ParameterResolverFactory getParameterResolverFactory()
          Returns the ParameterResolverFactory used by this inspector to resolve values for handler parameters
 Class<T> getSagaType()
          Returns the type of saga this inspector handles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SagaMethodMessageHandlerInspector

protected SagaMethodMessageHandlerInspector(Class<T> sagaType,
                                            ParameterResolverFactory parameterResolverFactory)
Initialize the inspector to handle events for the given sagaType.

Parameters:
sagaType - The type of saga this inspector handles
parameterResolverFactory - The factory for parameter resolvers that resolve parameters for the annotated methods
Method Detail

getInstance

public static <T extends AbstractAnnotatedSaga> SagaMethodMessageHandlerInspector<T> getInstance(Class<T> sagaType,
                                                                                                 ParameterResolverFactory parameterResolverFactory)
Returns a SagaMethodMessageHandlerInspector for the given sagaType. The inspector provides information about @SagaEventHandler annotated handler methods.

Type Parameters:
T - The type of Saga to get the inspector for
Parameters:
sagaType - The type of Saga to get the inspector for
parameterResolverFactory - The factory for parameter resolvers that resolve parameters for the annotated methods
Returns:
The inspector for the given saga type

getMessageHandlers

public List<SagaMethodMessageHandler> getMessageHandlers(EventMessage event)
Find the configuration for the handlers for the given event. If no suitable handler is found, an empty list is returned. The handlers are returned in the order they should be inspected to match against the association value. The first handler in the list to match an association value of the Saga instance should be used to invoke that saga.

Parameters:
event - The Event to investigate the handler for
Returns:
the configuration of the handlers, as defined by the annotations.

findHandlerMethod

public SagaMethodMessageHandler findHandlerMethod(AbstractAnnotatedSaga target,
                                                  EventMessage event)
Finds the handler method on given target for the given event.

Parameters:
target - The instance to find a handler method on
event - The event to find a handler for
Returns:
the most suitable handler for the event on the target, or an instance describing no such handler exists

getSagaType

public Class<T> getSagaType()
Returns the type of saga this inspector handles.

Returns:
the type of saga (Class) this inspector handles

getParameterResolverFactory

public ParameterResolverFactory getParameterResolverFactory()
Returns the ParameterResolverFactory used by this inspector to resolve values for handler parameters

Returns:
the ParameterResolverFactory used by this inspector


Copyright © 2010-2016. All Rights Reserved.