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 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 the rehydrate(AggregateEventStream) method
    • rehydrate

      AGGREGATE_TYPE rehydrate(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

      EventOrder eventOrderOfLastRehydratedEvent()
      Get the eventOrder of the last event during aggregate hydration (using the rehydrate(AggregateEventStream) method)
      Returns:
      the event order of the last applied Event or EventOrder.NO_EVENTS_PERSISTED in case no events has ever been applied to the aggregate