Record Class UserDetailsDto

java.lang.Object
java.lang.Record
com.app.security.dto.UserDetailsDto
Record Components:
username - the unique username of the user
password - the password (encoded) of the user
enable - indicates if the user's account is enabled
role - the role of the user, used for authorization

public record UserDetailsDto(String username, String password, boolean enable, String role) extends Record
Data Transfer Object (DTO) used to represent the details of a user.

This class encapsulates the information related to a user's authentication and authorization:

  • username - The unique username of the user.
  • password - The password of the user (in its encoded form).
  • enable - A boolean indicating if the user account is enabled or not.
  • role - The role assigned to the user (e.g., "USER", "ADMIN", etc.).
  • Constructor Details

    • UserDetailsDto

      public UserDetailsDto(String username, String password, boolean enable, String role)
      Creates an instance of a UserDetailsDto record class.
      Parameters:
      username - the value for the username record component
      password - the value for the password record component
      enable - the value for the enable record component
      role - the value for the role record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • password

      public String password()
      Returns the value of the password record component.
      Returns:
      the value of the password record component
    • enable

      public boolean enable()
      Returns the value of the enable record component.
      Returns:
      the value of the enable record component
    • role

      public String role()
      Returns the value of the role record component.
      Returns:
      the value of the role record component