- All Implemented Interfaces and Traits:
- PostMapConstructorCheckable
@KwrkImmutable
@CompileStatic
class Customer
extends Object
implements PostMapConstructorCheckable
Encapsulates attributes interesting in booking
bounded context of the Customer aggregate from external bounded context responsible for Customer aggregate management.
Encapsulated attributes are CustomerId and CustomerType and both must be non-null
values. Further constraints are implemented inside those classes.
In general, we will fetch customer representation for booking
context through some kind of outbound adapter. Its implementation, or more probably, contacted external bounded context,
should be capable of mapping any type of user identifier to the real Customer aggregate in external bounded context. For example, a user identifier might be conventional as an email or
username or more advanced like a persistent cookie, bearer token, or session identifier.
CustomerId encapsulated in this context's customer representation is none of those. Instead, CustomerId
is an identifier for the Customer aggregate stored and managed by mentioned
external bounded context.
Note: we don't have customer management context yet, but we can still simulate what some future (anti-corruption) outbound adapter should return in booking
bounded context.