Record Class CreateUserDto
java.lang.Object
java.lang.Record
dev.fernando.user_authentication_api.dto.CreateUserDto
- Record Components:
username- the user's nameemail- the user's emailpassword- the user's passwordphone- the user's phone numbercpf- the user's CPF (Brazilian ID)birthdayDate- the user's birthday date
public record CreateUserDto(String username, String email, String password, String phone, String cpf, Date birthdayDate)
extends Record
Data Transfer Object for creating a new user.
Contains user registration information such as username, email, password, phone, cpf, and birthday date.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebirthdayDaterecord component.cpf()Returns the value of thecpfrecord component.dateToEpoch(Date date) Converts a Date object to its epoch time representation in milliseconds for storage in the database.email()Returns the value of theemailrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.password()Returns the value of thepasswordrecord component.phone()Returns the value of thephonerecord component.final StringtoString()Returns a string representation of this record class.toUser()Converts this CreateUserDto to a User model object.username()Returns the value of theusernamerecord component.
-
Constructor Details
-
CreateUserDto
public CreateUserDto(String username, String email, String password, String phone, String cpf, Date birthdayDate) Creates an instance of aCreateUserDtorecord class.- Parameters:
username- the value for theusernamerecord componentemail- the value for theemailrecord componentpassword- the value for thepasswordrecord componentphone- the value for thephonerecord componentcpf- the value for thecpfrecord componentbirthdayDate- the value for thebirthdayDaterecord component
-
-
Method Details
-
toUser
Converts this CreateUserDto to a User model object.- Returns:
- a User object populated with the data from this DTO
-
dateToEpoch
Converts a Date object to its epoch time representation in milliseconds for storage in the database.- Parameters:
date- the Date object to convert- Returns:
- the epoch time in milliseconds, or null if the date is null
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
username
Returns the value of theusernamerecord component.- Returns:
- the value of the
usernamerecord component
-
email
Returns the value of theemailrecord component.- Returns:
- the value of the
emailrecord component
-
password
Returns the value of thepasswordrecord component.- Returns:
- the value of the
passwordrecord component
-
phone
Returns the value of thephonerecord component.- Returns:
- the value of the
phonerecord component
-
cpf
Returns the value of thecpfrecord component.- Returns:
- the value of the
cpfrecord component
-
birthdayDate
Returns the value of thebirthdayDaterecord component.- Returns:
- the value of the
birthdayDaterecord component
-