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 thebirthdayDate
record component.cpf()
Returns the value of thecpf
record 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 theemail
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.password()
Returns the value of thepassword
record component.phone()
Returns the value of thephone
record component.final String
toString()
Returns a string representation of this record class.toUser()
Converts this CreateUserDto to a User model object.username()
Returns the value of theusername
record component.
-
Constructor Details
-
CreateUserDto
public CreateUserDto(String username, String email, String password, String phone, String cpf, Date birthdayDate) Creates an instance of aCreateUserDto
record class.- Parameters:
username
- the value for theusername
record componentemail
- the value for theemail
record componentpassword
- the value for thepassword
record componentphone
- the value for thephone
record componentcpf
- the value for thecpf
record componentbirthdayDate
- the value for thebirthdayDate
record 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 theusername
record component.- Returns:
- the value of the
username
record component
-
email
Returns the value of theemail
record component.- Returns:
- the value of the
email
record component
-
password
Returns the value of thepassword
record component.- Returns:
- the value of the
password
record component
-
phone
Returns the value of thephone
record component.- Returns:
- the value of the
phone
record component
-
cpf
Returns the value of thecpf
record component.- Returns:
- the value of the
cpf
record component
-
birthdayDate
Returns the value of thebirthdayDate
record component.- Returns:
- the value of the
birthdayDate
record component
-