Interface Aggregate<ID,AGGREGATE_TYPE extends Aggregate<ID,AGGREGATE_TYPE>>
- Type Parameters:
ID- the aggregate id (or stream-id) type
- All Known Subinterfaces:
StatefulAggregate<ID,EVENT_TYPE, AGGREGATE_TYPE>
- All Known Implementing Classes:
AggregateRoot,AggregateRoot,AggregateRootWithState,FlexAggregate
public interface Aggregate<ID,AGGREGATE_TYPE extends Aggregate<ID,AGGREGATE_TYPE>>
Common interface that all concrete (classical)
Aggregate's must implement. Most concrete implementations choose to extend the AggregateRoot class.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionThe id of the aggregate (aka.dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.types.EventOrderGet the eventOrder of the last event during aggregate hydration (using therehydrate(AggregateEventStream)method)booleanHas the aggregate been initialized using previously recorded/persisted events (aka.rehydrate(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateEventStream<ID> persistedEvents) Effectively performs a leftFold over all the previously persisted events related to this aggregate instance
-
Method Details
-
aggregateId
ID aggregateId()The id of the aggregate (aka. the stream-id) -
hasBeenRehydrated
boolean hasBeenRehydrated()Has the aggregate been initialized using previously recorded/persisted events (aka. historic events) using therehydrate(AggregateEventStream)method -
rehydrate
AGGREGATE_TYPE rehydrate(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateEventStream<ID> persistedEvents) Effectively performs a leftFold over all the previously persisted events related to this aggregate instance- Parameters:
persistedEvents- the previous persisted events related to this aggregate instance, aka. the aggregates history- Returns:
- the same aggregate instance (self)
-
eventOrderOfLastRehydratedEvent
dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.types.EventOrder eventOrderOfLastRehydratedEvent()Get the eventOrder of the last event during aggregate hydration (using therehydrate(AggregateEventStream)method)- Returns:
- the event order of the last applied
EventorEventOrder.NO_EVENTS_PREVIOUSLY_PERSISTEDin case no events has ever been applied to the aggregate
-