Record Class CreateUserDto
java.lang.Object
java.lang.Record
com.app.controller.dto.user.CreateUserDto
- Record Components:
firstName
- the user's first name (currently unused in mapping)name
- the user's given name (used in entity)surname
- the user's surnameusername
- the desired username for loginpassword
- the user's passwordemail
- the user's email addressage
- the user's age
public record CreateUserDto(String firstName, String name, String surname, String username, String password, String email, int age)
extends Record
Data Transfer Object (DTO) used to create a new regular user.
Contains personal and account information needed for user registration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
age()
Returns the value of theage
record component.email()
Returns the value of theemail
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of thefirstName
record component.final int
hashCode()
Returns a hash code value for this object.name()
Returns the value of thename
record component.password()
Returns the value of thepassword
record component.surname()
Returns the value of thesurname
record component.toEntity()
Converts this DTO into aUserEntity
with default settings.final String
toString()
Returns a string representation of this record class.username()
Returns the value of theusername
record component.
-
Constructor Details
-
CreateUserDto
public CreateUserDto(String firstName, String name, String surname, String username, String password, String email, int age) Creates an instance of aCreateUserDto
record class.- Parameters:
firstName
- the value for thefirstName
record componentname
- the value for thename
record componentsurname
- the value for thesurname
record componentusername
- the value for theusername
record componentpassword
- the value for thepassword
record componentemail
- the value for theemail
record componentage
- the value for theage
record component
-
-
Method Details
-
toEntity
Converts this DTO into aUserEntity
with default settings. Sets the role toRole.ROLE_WORKER
, disables the account by default, and initializes holiday hours to 0.- Returns:
- a new
UserEntity
instance based on this DTO
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
firstName
-
name
-
surname
-
username
-
password
-
email
-
age
-