Class CommandBusInterceptorChain.DefaultCommandBusInterceptorChain
- java.lang.Object
-
- dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptorChain.DefaultCommandBusInterceptorChain
-
- All Implemented Interfaces:
CommandBusInterceptorChain
- Enclosing interface:
- CommandBusInterceptorChain
public static class CommandBusInterceptorChain.DefaultCommandBusInterceptorChain extends Object implements CommandBusInterceptorChain
Default implementation for theCommandBusInterceptorChain. It's recommended to useCommandBusInterceptorChain.newInterceptorChain(Object, CommandHandler, List, BiFunction, Function)to create a new chain
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptorChain
CommandBusInterceptorChain.DefaultCommandBusInterceptorChain
-
-
Constructor Summary
Constructors Constructor Description DefaultCommandBusInterceptorChain(Object command, CommandHandler matchedCommandHandler, List<CommandBusInterceptor> interceptors, BiFunction<CommandBusInterceptor,CommandBusInterceptorChain,Object> interceptorOperationInvoker, Function<Object,Object> defaultCommandBusBehaviour)Create a newCommandBusInterceptorChaininstance for the handling of a Command
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectcommand()The command associated with the interceptor chainCommandHandlermatchedCommandHandler()The singleCommandHandlerthe responded true toCommandHandler.canHandle(Class)Objectproceed()To continue the processing aCommandBusInterceptorwill call this method, which in turn will call otherCommandBusInterceptor's (if more interceptors are configured) and finally theLocalCommandBus's default implementation will be called.
If theCommandBusInterceptorcan provide a result without calling the defaultLocalCommandBusbehaviour then it can just return its (e.g.
-
-
-
Constructor Detail
-
DefaultCommandBusInterceptorChain
public DefaultCommandBusInterceptorChain(Object command, CommandHandler matchedCommandHandler, List<CommandBusInterceptor> interceptors, BiFunction<CommandBusInterceptor,CommandBusInterceptorChain,Object> interceptorOperationInvoker, Function<Object,Object> defaultCommandBusBehaviour)
Create a newCommandBusInterceptorChaininstance for the handling of a Command- Parameters:
command- the command instancematchedCommandHandler- the singleCommandHandlerthe responded true toCommandHandler.canHandle(Class)interceptors- theCommandBusInterceptor's (can be an empty List if no interceptors have been configured)interceptorOperationInvoker- the function responsible for calling the correctCommandBusInterceptorsendmethoddefaultCommandBusBehaviour- the function invoking the defaultLocalCommandBussendmethod logic
-
-
Method Detail
-
proceed
public Object proceed()
Description copied from interface:CommandBusInterceptorChainTo continue the processing aCommandBusInterceptorwill call this method, which in turn will call otherCommandBusInterceptor's (if more interceptors are configured) and finally theLocalCommandBus's default implementation will be called.
If theCommandBusInterceptorcan provide a result without calling the defaultLocalCommandBusbehaviour then it can just return its (e.g. cached) result and not callCommandBusInterceptorChain.proceed()- Specified by:
proceedin interfaceCommandBusInterceptorChain- Returns:
- the result of the operation
-
command
public Object command()
Description copied from interface:CommandBusInterceptorChainThe command associated with the interceptor chain- Specified by:
commandin interfaceCommandBusInterceptorChain- Returns:
- The command associated with the interceptor chain
-
matchedCommandHandler
public CommandHandler matchedCommandHandler()
Description copied from interface:CommandBusInterceptorChainThe singleCommandHandlerthe responded true toCommandHandler.canHandle(Class)- Specified by:
matchedCommandHandlerin interfaceCommandBusInterceptorChain- Returns:
- the matched command handler
-
-