Compares this Value Object with another for equality. Value Objects are equal if they are of the same type and all equality components match.
The other Value Object to compare with
true if the Value Objects are equal, false otherwise
StaticcreateCreates an Address instance with validation.
The address properties
Success with Address or Failure with DomainError
Formats the address as a single line string.
A formatted address string
Formats the address as a multi-line string.
A multi-line formatted address string
Checks if this address is in the same city as another address.
The other address to compare
true if both addresses are in the same city
Checks if this address is in the same country as another address.
The other address to compare
true if both addresses are in the same country
ProtectedgetReturns the components that determine equality for this Value Object. Two Value Objects are equal if all their equality components are equal.
An array of values used for equality comparison
Returns a string representation of an object.
Represents a physical address.
Address is immutable and validates required fields. Provides formatting and comparison capabilities.
Example