Class DefaultHandlerInterceptorRegistry
- All Implemented Interfaces:
DescribableComponent,HandlerInterceptorRegistry
HandlerInterceptorRegistry, maintaining lists of CommandMessage,
EventMessage, and QueryMessage-specific
MessageHandlerInterceptors.
This implementation ensures give interceptor factory methods are only invoked once.
- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<MessageHandlerInterceptor<? super CommandMessage>> commandInterceptors(Configuration config) Returns the list ofCommandMessage-specificMessageHandlerInterceptorsregistered in this registry.voiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.List<MessageHandlerInterceptor<? super EventMessage>> eventInterceptors(Configuration config) Returns the list ofEventMessage-specificMessageHandlerInterceptorsregistered in this registry.List<MessageHandlerInterceptor<? super QueryMessage>> queryInterceptors(Configuration config) Returns the list ofQueryMessage-specificMessageHandlerInterceptorsregistered in this registry.registerCommandInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super CommandMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aCommandMessageMessageHandlerInterceptorfor all command handling infrastructure components.registerEventInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super EventMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aEventMessageMessageHandlerInterceptorfor all event handling infrastructure componentsregisterInterceptor(ComponentBuilder<MessageHandlerInterceptor<Message>> interceptorBuilder) Registers the giveninterceptorBuilderconstructing a genericMessageMessageHandlerInterceptorfor all handling infrastructure components.registerQueryInterceptor(ComponentBuilder<MessageHandlerInterceptor<? super QueryMessage>> interceptorBuilder) Registers the giveninterceptorBuilderfor aQueryMessageMessageHandlerInterceptorfor all query handling infrastructure components
-
Constructor Details
-
DefaultHandlerInterceptorRegistry
public DefaultHandlerInterceptorRegistry()
-
-
Method Details
-
registerInterceptor
@Nonnull public HandlerInterceptorRegistry registerInterceptor(@Nonnull ComponentBuilder<MessageHandlerInterceptor<Message>> interceptorBuilder) Description copied from interface:HandlerInterceptorRegistryRegisters the giveninterceptorBuilderconstructing a genericMessageMessageHandlerInterceptorfor all handling infrastructure components.- Specified by:
registerInterceptorin interfaceHandlerInterceptorRegistry- Parameters:
interceptorBuilder- The genericMessageMessageHandlerInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
registerCommandInterceptor
@Nonnull public HandlerInterceptorRegistry registerCommandInterceptor(@Nonnull ComponentBuilder<MessageHandlerInterceptor<? super CommandMessage>> interceptorBuilder) Description copied from interface:HandlerInterceptorRegistryRegisters the giveninterceptorBuilderfor aCommandMessageMessageHandlerInterceptorfor all command handling infrastructure components.- Specified by:
registerCommandInterceptorin interfaceHandlerInterceptorRegistry- Parameters:
interceptorBuilder- TheCommandMessage-specificMessageHandlerInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
registerEventInterceptor
@Nonnull public HandlerInterceptorRegistry registerEventInterceptor(@Nonnull ComponentBuilder<MessageHandlerInterceptor<? super EventMessage>> interceptorBuilder) Description copied from interface:HandlerInterceptorRegistryRegisters the giveninterceptorBuilderfor aEventMessageMessageHandlerInterceptorfor all event handling infrastructure components- Specified by:
registerEventInterceptorin interfaceHandlerInterceptorRegistry- Parameters:
interceptorBuilder- TheEventMessage-specificMessageHandlerInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
registerQueryInterceptor
@Nonnull public HandlerInterceptorRegistry registerQueryInterceptor(@Nonnull ComponentBuilder<MessageHandlerInterceptor<? super QueryMessage>> interceptorBuilder) Description copied from interface:HandlerInterceptorRegistryRegisters the giveninterceptorBuilderfor aQueryMessageMessageHandlerInterceptorfor all query handling infrastructure components- Specified by:
registerQueryInterceptorin interfaceHandlerInterceptorRegistry- Parameters:
interceptorBuilder- TheQueryMessage-specificMessageHandlerInterceptorbuilder to register.- Returns:
- This
InterceptorRegistry, for fluent interfacing.
-
commandInterceptors
@Nonnull public List<MessageHandlerInterceptor<? super CommandMessage>> commandInterceptors(@Nonnull Configuration config) Description copied from interface:HandlerInterceptorRegistryReturns the list ofCommandMessage-specificMessageHandlerInterceptorsregistered in this registry.This collection contains all generic
MessageMessageHandlerInterceptorsthat have beenregisteredas well.- Specified by:
commandInterceptorsin interfaceHandlerInterceptorRegistry- Parameters:
config- The configuration to build allCommandMessage-specificMessageHandlerInterceptorswith.- Returns:
- The list of
CommandMessage-specificMessageHandlerInterceptors.
-
eventInterceptors
@Nonnull public List<MessageHandlerInterceptor<? super EventMessage>> eventInterceptors(@Nonnull Configuration config) Description copied from interface:HandlerInterceptorRegistryReturns the list ofEventMessage-specificMessageHandlerInterceptorsregistered in this registry.This collection contains all generic
MessageMessageHandlerInterceptorsthat have beenregisteredas well.- Specified by:
eventInterceptorsin interfaceHandlerInterceptorRegistry- Parameters:
config- The configuration to build allEventMessage-specificMessageHandlerInterceptorswith.- Returns:
- The list of
EventMessage-specificMessageHandlerInterceptors.
-
queryInterceptors
@Nonnull public List<MessageHandlerInterceptor<? super QueryMessage>> queryInterceptors(@Nonnull Configuration config) Description copied from interface:HandlerInterceptorRegistryReturns the list ofQueryMessage-specificMessageHandlerInterceptorsregistered in this registry.This collection contains all generic
MessageMessageHandlerInterceptorsthat have beenregisteredas well.- Specified by:
queryInterceptorsin interfaceHandlerInterceptorRegistry- Parameters:
config- The configuration to build allQueryMessage-specificMessageHandlerInterceptorswith.- Returns:
- The list of
QueryMessage-specificMessageHandlerInterceptors.
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.Best Practices: As a general rule, all relevant fields of a
DescribableComponentimplementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing thedescribeTomethod, who should focus on providing information that is useful for understanding the component's configuration and state.Example implementation:
public void describeTo(ComponentDescriptor descriptor) { descriptor.describeProperty("name", this.name); descriptor.describeProperty("enabled", this.enabled); descriptor.describeProperty("configuration", this.configuration); // A nested component descriptor.describeProperty("handlers", this.eventHandlers); // A collection }- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-