AggregateId

Defines an aggregate root identifier that inherits multiple interfaces to support various functional requirements. As an identifier, it not only identifies the aggregate root but also supports naming, decorator pattern, tenant identification, and value comparison.

See also

Properties

Link copied to clipboard

The name of the aggregate.

Link copied to clipboard

The name of the bounded context this entity belongs to.

Link copied to clipboard
abstract val id: String

Represents a unique identifier for the implementing entity.

Link copied to clipboard
abstract override val namedAggregate: NamedAggregate

The named aggregate that this ID belongs to.

Link copied to clipboard
abstract val tenantId: String

Gets the tenant ID.

Functions

Link copied to clipboard
open operator override fun compareTo(other: AggregateId): Int

Compares two AggregateId instances for ordering, first ensuring they belong to the same aggregate. If they don't belong to the same aggregate, an IllegalArgumentException is thrown. Otherwise, the comparison is based on the identifier.

Link copied to clipboard

Compares the current AggregateId object for equality with another object. This method provides business logic equality comparison for AggregateId objects, comparing all relevant properties rather than just reference equality.

Link copied to clipboard

Calculates a hash value for the AggregateId.

Link copied to clipboard

Checks if two aggregates belong to the same context and have the same aggregate name.

Link copied to clipboard

Checks if this entity belongs to the same bounded context as another entity.

Link copied to clipboard
fun AggregateId.mod(divisor: Int): Int

Calculates the remainder when the ID's hash code is divided by the given divisor.