Class AggregateRootWithState<ID,​EVENT_TYPE extends Event<ID>,​STATE extends AggregateState<ID,​EVENT_TYPE>,​AGGREGATE_TYPE extends AggregateRootWithState<ID,​EVENT_TYPE,​STATE,​AGGREGATE_TYPE>>

  • Type Parameters:
    ID - the aggregate id type
    EVENT_TYPE - the type of event
    AGGREGATE_TYPE - the aggregate self type (i.e. your concrete aggregate type)
    STATE - the aggregate state type (i.e. your concrete aggregate state)
    All Implemented Interfaces:
    Aggregate<ID,​AGGREGATE_TYPE>, StatefulAggregate<ID,​EVENT_TYPE,​AGGREGATE_TYPE>

    public abstract class AggregateRootWithState<ID,​EVENT_TYPE extends Event<ID>,​STATE extends AggregateState<ID,​EVENT_TYPE>,​AGGREGATE_TYPE extends AggregateRootWithState<ID,​EVENT_TYPE,​STATE,​AGGREGATE_TYPE>>
    extends AggregateRoot<ID,​EVENT_TYPE,​AGGREGATE_TYPE>
    Variant of the AggregateRoot pattern where the aggregate's state and all EventHandler annotated methods are placed within the concrete AggregateState object.
    When the AggregateRootWithState is combined with AggregateState, then the AggregateRootWithState will contain the command methods and the AggregateState contains the state fields and the EventHandler annotated methods.