Class InstantiatedComponentDefinition<C>
- Type Parameters:
C- The declared type of the component.
- All Implemented Interfaces:
Component<C>,ComponentDefinition<C>,ComponentDefinition.ComponentCreator<C>,DescribableComponent
Component and ComponentDefinition that wraps a pre-instantiated component.
For internal use only. Instead, use static methods on ComponentDefinition to instantiate definitions.
- Since:
- 5.0.0
- Author:
- Allard Buijze
-
Nested Class Summary
Nested classes/interfaces inherited from class org.axonframework.common.configuration.AbstractComponent
AbstractComponent.HandlerRegistration<C>Nested classes/interfaces inherited from interface org.axonframework.common.configuration.Component
Component.Identifier<C>Nested classes/interfaces inherited from interface org.axonframework.common.configuration.ComponentDefinition
ComponentDefinition.ComponentCreator<C>, ComponentDefinition.IncompleteComponentDefinition<C> -
Constructor Summary
ConstructorsConstructorDescriptionInstantiatedComponentDefinition(Component.Identifier<C> identifier, C instance) Create the definition for a component with givenidentifierand giveninstance. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.doResolve(Configuration configuration) booleanIndicates whether the component has beenresolved.Methods inherited from class org.axonframework.common.configuration.AbstractComponent
createComponent, identifier, initLifecycle, isInitialized, name, onShutdown, onStart, rawType, resolveMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.common.configuration.ComponentDefinition
onShutdown, onShutdown, onStart, onStart
-
Constructor Details
-
InstantiatedComponentDefinition
public InstantiatedComponentDefinition(@Nonnull Component.Identifier<C> identifier, @Nonnull C instance) Create the definition for a component with givenidentifierand giveninstance.- Parameters:
identifier- The identifier of the component.instance- The instance the components resolves to.
-
-
Method Details
-
doResolve
-
isInstantiated
public boolean isInstantiated()Description copied from interface:ComponentIndicates whether the component has beenresolved.When true, any subsequent call to
Component.resolve(Configuration)will return that same instance.- Returns:
trueif the component has been instantiated, otherwisefalse.
-
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- Overrides:
describeToin classAbstractComponent<C,C> - Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-