Class HandlerDefinitionUtils
HandlerDefinition to the ComponentRegistry.
Ensures that the ComponentRegistry at all times has one HandlerDefinition component.
Subsequent invocations of
registerToComponentRegistry(ComponentRegistry, Function)/registerToComponentRegistry(ComponentRegistry, int, Function) will
decorate the existing
HandlerDefinition and given HandlerDefinition into a MultiHandlerDefinition.
Only a MultiHandlerDefinition applies a HandlerEnhancerDefinition to created handlers, so every
HandlerDefinition registered or decorated through this class is (re)assembled using the
current ComponentRegistry's composed HandlerEnhancerDefinition component
(see HandlerEnhancerDefinitionUtils). This guarantees the HandlerDefinition component always reflects
every configured enhancer, regardless of how many separate calls contributed to either component or in what order.
- Since:
- 5.3.2
- Author:
- Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidregisterToComponentRegistry(ComponentRegistry componentRegistry, int order, Function<Configuration, HandlerDefinition> handlerDefinitionBuilder) Register aHandlerDefinitionto thecurrentComponentRegistryusing the givenhandlerDefinitionBuilderfunction, placing the handlerDefinitionBuilder at the givenorder.static voidregisterToComponentRegistry(ComponentRegistry componentRegistry, Function<Configuration, HandlerDefinition> handlerDefinitionBuilder) Register aHandlerDefinitionto thecurrentComponentRegistryusing the givenhandlerDefinitionBuilderfunction.
-
Method Details
-
registerToComponentRegistry
public static void registerToComponentRegistry(ComponentRegistry componentRegistry, Function<Configuration, HandlerDefinition> handlerDefinitionBuilder) Register aHandlerDefinitionto thecurrentComponentRegistryusing the givenhandlerDefinitionBuilderfunction.It will be registered with order
0. To register with a different order, useregisterToComponentRegistry(ComponentRegistry, int, Function)instead.- Parameters:
componentRegistry- theComponentRegistryto register theHandlerDefinitiontohandlerDefinitionBuilder- theFunctionthat creates theHandlerDefinitionbased on theConfiguration
-
registerToComponentRegistry
public static void registerToComponentRegistry(ComponentRegistry componentRegistry, int order, Function<Configuration, HandlerDefinition> handlerDefinitionBuilder) Register aHandlerDefinitionto thecurrentComponentRegistryusing the givenhandlerDefinitionBuilderfunction, placing the handlerDefinitionBuilder at the givenorder.- Parameters:
componentRegistry- theComponentRegistryto register theHandlerDefinitiontoorder- the order in which theHandlerDefinitionshould be registeredhandlerDefinitionBuilder- theFunctionthat creates theHandlerDefinitionbased on theConfiguration
-