Class Component<B>

java.lang.Object
org.axonframework.config.Component<B>
Type Parameters:
B - The type of Component contained

public class Component<B> extends Object
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 Details

    • Component

      public Component(Configuration config, String name, Function<Configuration,? extends B> builderFunction)
      Creates a component for the given config with given name created by the given builderFunction. Then the Configuration is not initialized yet, consider using Component(Supplier, String, Function) instead.
      Parameters:
      config - The Configuration the component is part of
      name - The name of the component
      builderFunction - 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 given config with given name created by the given builderFunction.
      Parameters:
      config - The supplier function of the configuration
      name - The name of the component
      builderFunction - The builder function of the component
  • Method Details

    • get

      public B 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 the LifecycleHandlerInspector.registerLifecycleHandlers(Configuration, Object) methods will be called to resolve and register lifecycle methods.
      Returns:
      the initialized component contained in this instance
    • update

      public void update(@Nonnull Function<Configuration,? extends B> builderFunction)
      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 using get().
    • isInitialized

      public boolean isInitialized()
      Checks if the component is already initialized.
      Returns:
      true if component is initialized