Uses of Package
dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern
-
Classes in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern used by dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modernClassDescriptionA modern opinionated interpretation of the classic
AggregateRootdesign, where theEvent's are mutable.
The modern interpretation doesn't specify any requirement on the design of the Events, they can be Java 17+ records or simple POJO's.
Note: TheAggregateRootworks best in combination with theStatefulAggregateRepositorythat's configured to use theStatefulAggregateInstanceFactory.reflectionBasedAggregateRootFactory(), because theAggregateRootneeds to be provided its aggregated id through theAggregateRoot(Object)constructor!
The modernAggregateRootsupports keeping the state projection andEventHandlerannotated methods within theAggregateRootinstance or within anAggregateStateinstance.
If you wish to keep the state projection andEventHandlerannotated methods within anAggregateStateinstance, then you only need to implement theWithStateinterface:Aggregate state object associated with a givenAggregateRootinstance (seeAggregateState.getAggregate())
Example: