DefaultAggregateId

data class DefaultAggregateId(val namedAggregate: NamedAggregate, val id: String, val tenantId: String = TenantId.DEFAULT_TENANT_ID) : AggregateId

Represents a default implementation of AggregateId, which uniquely identifies an aggregate instance within a bounded context.

This data class provides a concrete implementation of the AggregateId interface, encapsulating the necessary information to identify an aggregate: the named aggregate, the instance ID, and the tenant ID.

Constructors

Link copied to clipboard
constructor(namedAggregate: NamedAggregate, id: String, tenantId: String = TenantId.DEFAULT_TENANT_ID)

Creates a new DefaultAggregateId with the specified named aggregate, ID, and optional tenant ID.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val id: String

The unique identifier for the aggregate instance as a string.

Link copied to clipboard
open override val namedAggregate: NamedAggregate

The NamedAggregate that this ID belongs to, defining the context and aggregate names.

Link copied to clipboard
open override val tenantId: String

The tenant identifier as a string, defaults to TenantId.DEFAULT_TENANT_ID for single-tenant scenarios.

Functions

Link copied to clipboard
fun NamedAggregate.aggregateId(id: String = generateId(), tenantId: String = TenantId.DEFAULT_TENANT_ID): DefaultAggregateId

Creates an AggregateId for this NamedAggregate with the specified parameters.

Link copied to clipboard

Finds the aggregate type class associated with this named aggregate.

Link copied to clipboard

Converts this NamedAggregate to its corresponding AggregateMetadata.

Link copied to clipboard
open operator override fun compareTo(other: AggregateId): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Generates a unique ID string for this NamedAggregate.

Link copied to clipboard
fun NamedBoundedContext.getContextAlias(boundedContext: BoundedContext? = MetadataSearcher.metadata.contexts[contextName]): String
Link copied to clipboard

Gets the context alias prefix for this bounded context.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Checks if the named aggregate is available locally at runtime.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Finds the aggregate type class associated with this named aggregate, throwing an exception if not found.

Link copied to clipboard

Extension function to convert a NamedAggregate to an EventNamedAggregate.

Link copied to clipboard

Converts this NamedAggregate to its string representation.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Converts this NamedAggregate to a string representation using the context alias.