Class MultiHandlerDefinition
java.lang.Object
org.axonframework.messaging.core.annotation.MultiHandlerDefinition
- All Implemented Interfaces:
HandlerDefinition
HandlerDefinition instance that delegates to multiple other instances, in the order provided. Also, it wraps the
delegate with
HandlerEnhancerDefinition.- Since:
- 3.3.0
- Author:
- Tyler Thrailkill, Milan Savic
-
Constructor Summary
ConstructorsConstructorDescriptionMultiHandlerDefinition(List<HandlerDefinition> delegates) Initializes an instance that delegates to the givendelegates, in the order provided.MultiHandlerDefinition(List<HandlerDefinition> delegates, HandlerEnhancerDefinition handlerEnhancerDefinition) Initializes an instance that delegates to the givendelegates, in the order provided.MultiHandlerDefinition(HandlerDefinition... delegates) Initializes an instance that delegates to the givendelegates, in the order provided. -
Method Summary
Modifier and TypeMethodDescription<T> Optional<MessageHandlingMember<T>> createHandler(Class<T> declaringType, Method method, ParameterResolverFactory parameterResolverFactory, Function<Object, MessageStream<?>> messageStreamResolver) Create aMessageHandlingMemberfor the givenmethodmethod.Returns the delegates of this instance, in the order they are evaluated to resolve parameters.Returns handler enhancer definition used to wrap handlers.static MultiHandlerDefinitionordered(List<HandlerDefinition> delegates) Creates a MultiHandlerDefinition instance with the givendelegates, which are automatically ordered based on the@Priorityannotation on their respective classes.static MultiHandlerDefinitionordered(List<HandlerDefinition> delegates, HandlerEnhancerDefinition handlerEnhancerDefinition) Creates a MultiHandlerDefinition instance with the givendelegates, which are automatically ordered based on the@Priorityannotation on their respective classes.static MultiHandlerDefinitionordered(HandlerDefinition... delegates) Creates a MultiHandlerDefinition instance with the givendelegates, which are automatically ordered based on the@Priorityannotation on their respective classes.static MultiHandlerDefinitionordered(HandlerEnhancerDefinition handlerEnhancerDefinition, HandlerDefinition... delegates) Creates a MultiHandlerDefinition instance with the givendelegates, which are automatically ordered based on the@Priorityannotation on their respective classes.
-
Constructor Details
-
MultiHandlerDefinition
Initializes an instance that delegates to the givendelegates, in the order provided. Changes in the given array are not reflected in the created instance.- Parameters:
delegates- The handlerDefinitions providing the parameter values to use
-
MultiHandlerDefinition
Initializes an instance that delegates to the givendelegates, in the order provided. Changes in the given list are not reflected in the created instance.- Parameters:
delegates- The handlerDefinitions providing the parameter values to use
-
MultiHandlerDefinition
public MultiHandlerDefinition(List<HandlerDefinition> delegates, HandlerEnhancerDefinition handlerEnhancerDefinition) Initializes an instance that delegates to the givendelegates, in the order provided. Changes in the given List are not reflected in the created instance.- Parameters:
delegates- The list of handlerDefinitions providing the parameter values to usehandlerEnhancerDefinition- The enhancer used to wrap the delegates
-
-
Method Details
-
ordered
Creates a MultiHandlerDefinition instance with the givendelegates, which are automatically ordered based on the@Priorityannotation on their respective classes. Classes with the same Priority are kept in the order as provided in thedelegates. As an enhancer,ClasspathHandlerEnhancerDefinitionis used.If one of the delegates is a MultiHandlerDefinition itself, that factory's delegates are 'mixed' with the given
delegates, based on their respective order.- Parameters:
delegates- The delegates to include in the factory- Returns:
- an instance delegating to the given
delegates
-
ordered
public static MultiHandlerDefinition ordered(HandlerEnhancerDefinition handlerEnhancerDefinition, HandlerDefinition... delegates) Creates a MultiHandlerDefinition instance with the givendelegates, which are automatically ordered based on the@Priorityannotation on their respective classes. Classes with the same Priority are kept in the order as provided in thedelegates. As an enhancer, provided one is used.If one of the delegates is a MultiHandlerDefinition itself, that factory's delegates are 'mixed' with the given
delegates, based on their respective order.- Parameters:
handlerEnhancerDefinition- The enhancer used to wrap the delegatesdelegates- The delegates to include in the factory- Returns:
- an instance delegating to the given
delegates
-
ordered
Creates a MultiHandlerDefinition instance with the givendelegates, which are automatically ordered based on the@Priorityannotation on their respective classes. Classes with the same Priority are kept in the order as provided in thedelegates. As an enhancer,ClasspathHandlerEnhancerDefinitionis used.If one of the delegates is a MultiHandlerDefinition itself, that factory's delegates are 'mixed' with the given
delegates, based on their respective order.- Parameters:
delegates- The delegates to include in the factory- Returns:
- an instance delegating to the given
delegates
-
ordered
public static MultiHandlerDefinition ordered(List<HandlerDefinition> delegates, HandlerEnhancerDefinition handlerEnhancerDefinition) Creates a MultiHandlerDefinition instance with the givendelegates, which are automatically ordered based on the@Priorityannotation on their respective classes. Classes with the same Priority are kept in the order as provided in thedelegates. As an enhancer, provided one is used.If one of the delegates is a MultiHandlerDefinition itself, that factory's delegates are 'mixed' with the given
delegates, based on their respective order.- Parameters:
delegates- The delegates to include in the factoryhandlerEnhancerDefinition- The enhancer used to wrap the delegates- Returns:
- an instance delegating to the given
delegates
-
getDelegates
Returns the delegates of this instance, in the order they are evaluated to resolve parameters.- Returns:
- the delegates of this instance, in the order they are evaluated to resolve parameters
-
getHandlerEnhancerDefinition
Returns handler enhancer definition used to wrap handlers.- Returns:
- handler enhancer definition
-
createHandler
public <T> Optional<MessageHandlingMember<T>> createHandler(@Nonnull Class<T> declaringType, @Nonnull Method method, @Nonnull ParameterResolverFactory parameterResolverFactory, @Nonnull Function<Object, MessageStream<?>> messageStreamResolver) Description copied from interface:HandlerDefinitionCreate aMessageHandlingMemberfor the givenmethodmethod. Use the givenparameterResolverFactoryto resolve the method's parameters.- Specified by:
createHandlerin interfaceHandlerDefinition- Type Parameters:
T- The type of the declaring object- Parameters:
declaringType- The type of object declaring the given methodmethod- The method to inspectparameterResolverFactory- Factory for aParameterResolverof the methodmessageStreamResolver- The lambda resolving aMessageStreamout of the result fromMessageHandlingMember.handle(Message, ProcessingContext, Object).- Returns:
- An optional containing the handler if the method is suitable, or an empty Nullable otherwise.
-