AggregateMetadata

data class AggregateMetadata<C : Any, S : Any>(val namedAggregate: NamedAggregate, val staticTenantId: String?, val state: StateAggregateMetadata<S>, val command: CommandAggregateMetadata<C>) : NamedAggregateDecorator, Metadata

Represents the metadata for an aggregate, combining state and command aggregate metadata.

This data class encapsulates all the metadata required to work with an aggregate, including its named aggregate information, static tenant ID, state aggregate metadata, and command aggregate metadata. It provides utilities for extracting aggregate IDs and determining if the aggregate follows an aggregation pattern.

Type Parameters

C

The type of the command aggregate.

S

The type of the state aggregate.

Constructors

Link copied to clipboard
constructor(namedAggregate: NamedAggregate, staticTenantId: String?, state: StateAggregateMetadata<S>, command: CommandAggregateMetadata<C>)

Creates a new AggregateMetadata with the specified named aggregate, tenant ID, and metadata.

Properties

Link copied to clipboard

The metadata for the command aggregate.

Link copied to clipboard

Determines if this aggregate follows an aggregation pattern where state and command aggregates are different types.

Link copied to clipboard
open override val namedAggregate: NamedAggregate

The named aggregate that this metadata belongs to.

Link copied to clipboard

The metadata for the state aggregate.

Link copied to clipboard

The static tenant ID configured for this aggregate, or null if not configured.

Functions

Link copied to clipboard
fun AggregateMetadata<*, *>.aggregateId(id: String = generateId(), tenantId: String = staticTenantId ?: TenantId.DEFAULT_TENANT_ID): DefaultAggregateId

Creates an AggregateId for this AggregateMetadata with the specified parameters.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun extractAggregateId(state: S, aggregateId: String, tenantId: String = TenantId.DEFAULT_TENANT_ID): AggregateId
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun <S : Any> AggregateMetadata<*, S>.toStateAggregate(state: S, version: Int, ownerId: String = OwnerId.DEFAULT_OWNER_ID, spaceId: SpaceId = SpaceIdCapable.DEFAULT_SPACE_ID, eventId: String = "", firstOperator: String = "", operator: String = "", firstEventTime: Long = 0, eventTime: Long = 0, tags: AbacTags = EMPTY_ABAC_TAGS, deleted: Boolean = false, aggregateId: String = "", tenantId: String = TenantId.DEFAULT_TENANT_ID): StateAggregate<S>
Link copied to clipboard
open override fun toString(): String