Interface StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE>>
-
- Type Parameters:
ID- the type of idEVENT_TYPE- the type of eventAGGREGATE_TYPE- the aggregate type
- All Superinterfaces:
Aggregate<ID,AGGREGATE_TYPE>
- All Known Implementing Classes:
AggregateRoot,AggregateRoot,AggregateRootWithState
public interface StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE>> extends Aggregate<ID,AGGREGATE_TYPE>
A statefulAggregateis the most common form of Aggregate design in Object Oriented languages.
What makes anAggregatestateful is the fact that any changes, i.e. Events applied as the result of calling command methods on the aggregate instance, are stored within theStatefulAggregateprior to persisting the aggregate, and the events associated with any changes can be queried usinggetUncommittedChanges()and is reset (e.g. after a transaction/UnitOfWorkhas completed) usingmarkChangesAsCommitted()
SeeFlexAggregatefor an immutableAggregatedesign
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EventsToPersist<ID,EVENT_TYPE>getUncommittedChanges()Query any changes to the Aggregate, i.e.voidmarkChangesAsCommitted()Resets thegetUncommittedChanges()- effectively marking them as having been persisted and committed to the underlyingEventStore-
Methods inherited from interface dk.cloudcreate.essentials.components.eventsourced.aggregates.Aggregate
aggregateId, eventOrderOfLastRehydratedEvent, hasBeenRehydrated, rehydrate
-
-
-
-
Method Detail
-
getUncommittedChanges
EventsToPersist<ID,EVENT_TYPE> getUncommittedChanges()
Query any changes to the Aggregate, i.e. Events applied as the result of calling command methods on the aggregate instance,- Returns:
- the changes to the aggregate
-
markChangesAsCommitted
void markChangesAsCommitted()
Resets thegetUncommittedChanges()- effectively marking them as having been persisted and committed to the underlyingEventStore
-
-