java.lang.Object
java.lang.Record
org.ntnu.idi.idatt2106.sparesti.sparestibackend.dto.user.UserResponse
Record Components:
id - Id of user
firstName - First name
lastName - Last name
username - username
email - Email
spendingAccount - Spending account
savingAccount - saving account
savedAmount - Saved money
badges - User badges
hasPasskey - Boolean for whether user has biometric login
All Implemented Interfaces:
Serializable

public record UserResponse(Long id, @NotNull String firstName, @NotNull String lastName, @NotNull String username, @NotNull @Email String email, @NotNull AccountDTO spendingAccount, @NotNull AccountDTO savingAccount, @NotNull BigDecimal savedAmount, @NotNull Set<BadgeDTO> badges, @NotNull Boolean hasPasskey) extends Record implements Serializable
DTO for User
See Also:
  • Constructor Details

    • UserResponse

      public UserResponse(Long id, @NotNull @NotNull String firstName, @NotNull @NotNull String lastName, @NotNull @NotNull String username, @NotNull @Email @NotNull @Email String email, @NotNull @NotNull AccountDTO spendingAccount, @NotNull @NotNull AccountDTO savingAccount, @NotNull @NotNull BigDecimal savedAmount, @NotNull @NotNull Set<BadgeDTO> badges, @NotNull @NotNull Boolean hasPasskey)
      Creates an instance of a UserResponse record class.
      Parameters:
      id - the value for the id record component
      firstName - the value for the firstName record component
      lastName - the value for the lastName record component
      username - the value for the username record component
      email - the value for the email record component
      spendingAccount - the value for the spendingAccount record component
      savingAccount - the value for the savingAccount record component
      savedAmount - the value for the savedAmount record component
      badges - the value for the badges record component
      hasPasskey - the value for the hasPasskey 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • id

      public Long id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • firstName

      @NotNull public @NotNull String firstName()
      Returns the value of the firstName record component.
      Returns:
      the value of the firstName record component
    • lastName

      @NotNull public @NotNull String lastName()
      Returns the value of the lastName record component.
      Returns:
      the value of the lastName record component
    • username

      @NotNull public @NotNull String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • email

      @NotNull @Email public @NotNull @Email String email()
      Returns the value of the email record component.
      Returns:
      the value of the email record component
    • spendingAccount

      @NotNull public @NotNull AccountDTO spendingAccount()
      Returns the value of the spendingAccount record component.
      Returns:
      the value of the spendingAccount record component
    • savingAccount

      @NotNull public @NotNull AccountDTO savingAccount()
      Returns the value of the savingAccount record component.
      Returns:
      the value of the savingAccount record component
    • savedAmount

      @NotNull public @NotNull BigDecimal savedAmount()
      Returns the value of the savedAmount record component.
      Returns:
      the value of the savedAmount record component
    • badges

      @NotNull public @NotNull Set<BadgeDTO> badges()
      Returns the value of the badges record component.
      Returns:
      the value of the badges record component
    • hasPasskey

      @NotNull public @NotNull Boolean hasPasskey()
      Returns the value of the hasPasskey record component.
      Returns:
      the value of the hasPasskey record component