StateAggregateMetadata
data class StateAggregateMetadata<S : Any>(val aggregateType: Class<S>, val constructorAccessor: ConstructorAccessor<S>, val aggregateIdAccessor: PropertyGetter<S, String>?, val sourcingFunctionRegistry: Map<Class<*>, FunctionAccessorMetadata<S, Void>>) : TypedAggregate<S> , Metadata
Represents the metadata for a state aggregate, containing information needed for state management and event sourcing.
This data class holds the configuration for a state aggregate, including constructor accessors, aggregate ID accessors, and sourcing function registries for handling domain events.
Parameters
S
The type of the state aggregate.
Constructors
Link copied to clipboard
constructor(aggregateType: Class<S>, constructorAccessor: ConstructorAccessor<S>, aggregateIdAccessor: PropertyGetter<S, String>?, sourcingFunctionRegistry: Map<Class<*>, FunctionAccessorMetadata<S, Void>>)
Creates a new StateAggregateMetadata with the specified properties.
Properties
Link copied to clipboard
The optional property getter for accessing the aggregate ID from the state.
Link copied to clipboard
State Aggregation Type
Link copied to clipboard
The accessor for creating state aggregate instances.
Link copied to clipboard
Map of event types to their sourcing function metadata.
Functions
Link copied to clipboard
fun toMessageFunctionRegistry(stateRoot: S): Map<Class<*>, MessageFunction<S, DomainEventExchange<*>, Void>>
Converts the sourcing function registry into executable message functions.
Link copied to clipboard
fun <S : Any> StateAggregateMetadata<S>.toStateAggregate(aggregateId: AggregateId, state: S, version: Int, ownerId: String = OwnerId.DEFAULT_OWNER_ID, eventId: String = "", firstOperator: String = "", operator: String = "", firstEventTime: Long = 0, eventTime: Long = 0, deleted: Boolean = false): StateAggregate<S>