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.
The id must be unique within the same namedAggregate, regardless of tenantId. The tenant ID provides routing and isolation context; it does not create a separate namespace in which the same aggregate ID may be reused. Consequently, two instances of the same named aggregate must never share an id, even when they belong to different tenants.
See also
Properties
The name of the aggregate.
The name of the bounded context this entity belongs to.
The named aggregate that this ID belongs to. Within this scope, id is unique across all tenants.
Functions
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.
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.
Calculates a hash value for the AggregateId.
Checks if two aggregates belong to the same context and have the same aggregate name.
Checks if this entity belongs to the same bounded context as another entity.
Calculates the remainder when the ID's hash code is divided by the given divisor.