Record Class UserParent
java.lang.Object
java.lang.Record
de.murmelmeister.murmelapi.user.parent.UserParent
- Record Components:
expiresAt- NullablechangedBy- NullablechangedAt- Nullable
public record UserParent(int userId, int parentId, LocalDateTime expiresAt, int createdBy, LocalDateTime createdAt, Integer changedBy, LocalDateTime changedAt)
extends Record
Represents a parent assigned to a user, including expiration details.
This record is immutable and provides methods to check if the parent has expired
and to create a new instance with updated metadata.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LocalDateTimeThe field for thechangedAtrecord component.private final IntegerThe field for thechangedByrecord component.private final LocalDateTimeThe field for thecreatedAtrecord component.private final intThe field for thecreatedByrecord component.private final LocalDateTimeThe field for theexpiresAtrecord component.private final intThe field for theparentIdrecord component.private final intThe field for theuserIdrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionUserParent(int userId, int parentId, LocalDateTime expiresAt, int createdBy, LocalDateTime createdAt, Integer changedBy, LocalDateTime changedAt) Creates an instance of aUserParentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thechangedAtrecord component.Returns the value of thechangedByrecord component.Returns the value of thecreatedAtrecord component.intReturns the value of thecreatedByrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpiresAtrecord component.final inthashCode()Returns a hash code value for this object.booleanbooleanintparentId()Returns the value of theparentIdrecord component.final StringtoString()Returns a string representation of this record class.intuserId()Returns the value of theuserIdrecord component.withUpdateMeta(LocalDateTime expiresAt, Integer changedBy, LocalDateTime changedAt)
-
Field Details
-
userId
private final int userIdThe field for theuserIdrecord component. -
parentId
private final int parentIdThe field for theparentIdrecord component. -
expiresAt
The field for theexpiresAtrecord component. -
createdBy
private final int createdByThe field for thecreatedByrecord component. -
createdAt
The field for thecreatedAtrecord component. -
changedBy
The field for thechangedByrecord component. -
changedAt
The field for thechangedAtrecord component.
-
-
Constructor Details
-
UserParent
public UserParent(int userId, int parentId, LocalDateTime expiresAt, int createdBy, LocalDateTime createdAt, Integer changedBy, LocalDateTime changedAt) Creates an instance of aUserParentrecord class.- Parameters:
userId- the value for theuserIdrecord componentparentId- the value for theparentIdrecord componentexpiresAt- the value for theexpiresAtrecord componentcreatedBy- the value for thecreatedByrecord componentcreatedAt- the value for thecreatedAtrecord componentchangedBy- the value for thechangedByrecord componentchangedAt- the value for thechangedAtrecord component
-
-
Method Details
-
isExpired
public boolean isExpired() -
isPermanent
public boolean isPermanent() -
withUpdateMeta
public UserParent withUpdateMeta(LocalDateTime expiresAt, Integer changedBy, LocalDateTime changedAt) -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
userId
public int userId()Returns the value of theuserIdrecord component.- Returns:
- the value of the
userIdrecord component
-
parentId
public int parentId()Returns the value of theparentIdrecord component.- Returns:
- the value of the
parentIdrecord component
-
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-
createdBy
public int createdBy()Returns the value of thecreatedByrecord component.- Returns:
- the value of the
createdByrecord component
-
createdAt
Returns the value of thecreatedAtrecord component.- Returns:
- the value of the
createdAtrecord component
-
changedBy
Returns the value of thechangedByrecord component.- Returns:
- the value of the
changedByrecord component
-
changedAt
Returns the value of thechangedAtrecord component.- Returns:
- the value of the
changedAtrecord component
-