Uses of Class
dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern.AggregateRoot
-
Packages that use AggregateRoot Package Description dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern -
-
Uses of AggregateRoot in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern
Classes in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern with type parameters of type AggregateRoot Modifier and Type Class Description classAggregateRoot<ID,EVENT_TYPE,AGGREGATE_TYPE extends AggregateRoot<ID,EVENT_TYPE,AGGREGATE_TYPE>>A modern opinionated interpretation of the classicAggregateRootdesign, 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:classAggregateState<ID,EVENT_TYPE,AGGREGATE_TYPE extends AggregateRoot<ID,EVENT_TYPE,AGGREGATE_TYPE>>Aggregate state object associated with a givenAggregateRootinstance (seeAggregateState.getAggregate())
Example:interfaceWithState<ID,EVENT_TYPE,AGGREGATE_TYPE extends AggregateRoot<ID,EVENT_TYPE,AGGREGATE_TYPE>,AGGREGATE_STATE extends AggregateState<ID,EVENT_TYPE,AGGREGATE_TYPE>>Marker interface that indicates that all state and allEventHandlerannotated methods will be hosted with theAggregateStateobject.
-