Record Class Identity
java.lang.Object
java.lang.Record
org.jwcarman.who.core.domain.Identity
- Record Components:
id- the identity's stable idstatus- whether it may sign increatedAt- when it was createdupdatedAt- when it last changed
public record Identity(UUID id, IdentityStatus status, Instant createdAt, Instant updatedAt)
extends Record
Stable internal identity record. All application domain objects FK against the
id.-
Constructor Summary
ConstructorsConstructorDescriptionIdentity(UUID id, IdentityStatus status, Instant createdAt, Instant updatedAt) Validates that no field is null. -
Method Summary
Modifier and TypeMethodDescriptionstatic Identitycreate()Creates a newACTIVEIdentitywith a generated UUID and both timestamps set to now.static Identitycreate(IdentityStatus status) Creates a newIdentitywith a generated UUID and both timestamps set to now.Returns the value of thecreatedAtrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.status()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theupdatedAtrecord component.withStatus(IdentityStatus newStatus) Returns a newIdentitywith the given status and an updatedupdatedAttimestamp.
-
Constructor Details
-
Identity
Validates that no field is null.
-
-
Method Details
-
create
Creates a newACTIVEIdentitywith a generated UUID and both timestamps set to now.- Returns:
- a new active
Identity
-
create
Creates a newIdentitywith a generated UUID and both timestamps set to now.- Parameters:
status- the initial status- Returns:
- a new
Identity
-
withStatus
Returns a newIdentitywith the given status and an updatedupdatedAttimestamp.- Parameters:
newStatus- the new status- Returns:
- updated
Identity
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
id
-
status
-
createdAt
-
updatedAt
-