Class ConfigurationExtensions
- All Implemented Interfaces:
DescribableComponent
ConfigurationExtension instances for an
ExtensibleConfigurer parent configuration.
Extensions are created eagerly when extend(Class, Supplier) is called — the factory is invoked immediately
and the resulting instance is stored. If extend() is called again for the same type, the previous instance is
replaced. extension(Class) returns the stored instance, or null if no extension of that type has
been registered.
This class is not part of the public API. It exists purely to encapsulate extension management so that
ExtensibleConfigurer implementations can delegate to it without duplicating logic.
- Since:
- 5.1.0
- Author:
- Mateusz Nowak
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurationExtensions(ExtensibleConfigurer parentConfigurer) Constructs a newConfigurationExtensionsfor the givenparentConfigurer. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.<T extends ConfigurationExtension<?>>
ExtensibleConfigurerRegisters an extension by invoking the givenfactoryimmediately and storing the result.voidextendFrom(ConfigurationExtensions source) Copies extensions from the givensourcethat are not already present inthis.<T extends ConfigurationExtension<?>>
@Nullable TReturns the extension of the givenextensionType, ornullif no extension of that type has been registered viaextend(Class, Supplier).voidvalidate()Validates all registered extensions by callingConfigurationExtension.validate()on each.
-
Constructor Details
-
ConfigurationExtensions
Constructs a newConfigurationExtensionsfor the givenparentConfigurer.- Parameters:
parentConfigurer- the parent configuration that owns these extensions
-
-
Method Details
-
extension
Returns the extension of the givenextensionType, ornullif no extension of that type has been registered viaextend(Class, Supplier).- Type Parameters:
T- the extension type- Parameters:
extensionType- the extension class- Returns:
- the extension instance, or
nullif not registered
-
extend
public <T extends ConfigurationExtension<?>> ExtensibleConfigurer extend(Class<T> extensionType, Supplier<T> factory) Registers an extension by invoking the givenfactoryimmediately and storing the result.If an extension of the same type was previously registered, it is replaced — the factory always overrides the previous instance.
- Type Parameters:
T- the extension type- Parameters:
extensionType- the extension classfactory- a supplier that returns a configured extension- Returns:
- the parent configurer, for fluent chaining
-
validate
public void validate()Validates all registered extensions by callingConfigurationExtension.validate()on each.- Throws:
AxonConfigurationException- if any extension's validation fails
-
extendFrom
Copies extensions from the givensourcethat are not already present inthis. Existing extensions onthisare preserved.- Parameters:
source- The source to copy missing extensions from.
-
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.
-