Package org.axonframework.config
Class Component<B>
java.lang.Object
org.axonframework.config.Component<B>
- Type Parameters:
B- The type of Component contained
A Component used in the Axon Configurer. A Component describes an object that needs to be created, possibly based on
other components in the configuration, and initialized as part of a Configuration. Components are lazily initialized
when they are accessed. During the initialization, they may trigger initialization of components they depend on.
- Since:
- 3.0
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsConstructorDescriptionComponent(Supplier<Configuration> config, String name, Function<Configuration, ? extends B> builderFunction) Creates a component for the givenconfigwith givennamecreated by the givenbuilderFunction.Component(Configuration config, String name, Function<Configuration, ? extends B> builderFunction) Creates a component for the givenconfigwith givennamecreated by the givenbuilderFunction. -
Method Summary
Modifier and TypeMethodDescriptionget()Retrieves the object contained in this component, triggering the builder function if the component hasn't been built yet.booleanChecks if the component is already initialized.voidupdate(Function<Configuration, ? extends B> builderFunction) Updates the builder function for this component.
-
Constructor Details
-
Component
public Component(Configuration config, String name, Function<Configuration, ? extends B> builderFunction) Creates a component for the givenconfigwith givennamecreated by the givenbuilderFunction. Then the Configuration is not initialized yet, consider usingComponent(Supplier, String, Function)instead.- Parameters:
config- The Configuration the component is part ofname- The name of the componentbuilderFunction- The builder function of the component
-
Component
public Component(@Nonnull Supplier<Configuration> config, @Nonnull String name, @Nonnull Function<Configuration, ? extends B> builderFunction) Creates a component for the givenconfigwith givennamecreated by the givenbuilderFunction.- Parameters:
config- The supplier function of the configurationname- The name of the componentbuilderFunction- The builder function of the component
-
-
Method Details
-
get
Retrieves the object contained in this component, triggering the builder function if the component hasn't been built yet. Upon initiation of the instance theLifecycleHandlerInspector.registerLifecycleHandlers(Configuration, Object)methods will be called to resolve and register lifecycle methods.- Returns:
- the initialized component contained in this instance
-
update
Updates the builder function for this component.- Parameters:
builderFunction- The new builder function for the component- Throws:
IllegalStateException- when the component has already been retrieved usingget().
-
isInitialized
public boolean isInitialized()Checks if the component is already initialized.- Returns:
- true if component is initialized
-