Class SimpleEntityEvolvingComponent<E>
- Type Parameters:
E- The entity type to evolve.
- All Implemented Interfaces:
DescribableComponent,EntityEvolver<E>,EntityEvolvingComponent<E>
EntityEvolvingComponent that evolves a given entity of type E
by searching a specific EntityEvolver based on the QualifiedName in the
event's type.- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers, Steven van Beelen
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleEntityEvolvingComponent(Map<QualifiedName, EntityEvolver<E>> entityEvolvers) Constructs aSimpleEntityEvolvingComponentthat evolves an entity of typeethrough the givenentityEvolvers. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.evolve(E entity, EventMessage event, ProcessingContext context) Evolve the givenentityby applying the giveneventto it.All supportedevents, referenced through aQualifiedName.
-
Constructor Details
-
SimpleEntityEvolvingComponent
Constructs aSimpleEntityEvolvingComponentthat evolves an entity of typeethrough the givenentityEvolvers.- Parameters:
entityEvolvers- The map ofEntityEvolverinstance toQualifiedNameto evolve an entity through.
-
-
Method Details
-
evolve
Description copied from interface:EntityEvolverEvolve the givenentityby applying the giveneventto it.- Specified by:
evolvein interfaceEntityEvolver<E>- Parameters:
entity- The current entity to evolve with the givenevent.event- The event that might adjust theentity.context- The context within which to evolve theentityby the givenevent.- Returns:
- The evolved
entitybased on the givenevent, or the sameentitywhen nothing happened.
-
supportedEvents
Description copied from interface:EntityEvolvingComponentAll supportedevents, referenced through aQualifiedName.- Specified by:
supportedEventsin interfaceEntityEvolvingComponent<E>- Returns:
- All supported
events, referenced through aQualifiedName.
-
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.
-