create

open override fun <C : Any, S : Any> create(metadata: AggregateMetadata<C, S>, stateAggregate: StateAggregate<S>): CommandAggregate<C, S>

Creates a new SimpleCommandAggregate instance.

For aggregation patterns, the command root is constructed using the command metadata's constructor. For non-aggregation patterns, the state aggregate's state is used directly as the command root.

Return

A new SimpleCommandAggregate instance.

Parameters

C

The type of the command aggregate root.

S

The type of the state aggregate.

metadata

The aggregate metadata containing configuration.

stateAggregate

The state aggregate to associate with the command aggregate.