Record Class UserDTO

java.lang.Object
java.lang.Record
edu.ucsb.cs156.dining.models.UserDTO

public record UserDTO(long id, String email, String googleSub, String pictureUrl, String fullName, String givenName, String familyName, boolean emailVerified, String locale, String hostedDomain, boolean admin, boolean moderator, String alias, String proposedAlias, ModerationStatus status, LocalDate dateApproved) extends Record
Response model for user data with computed role flags.
  • Constructor Summary

    Constructors
    Constructor
    Description
    UserDTO(long id, String email, String googleSub, String pictureUrl, String fullName, String givenName, String familyName, boolean emailVerified, String locale, String hostedDomain, boolean admin, boolean moderator, String alias, String proposedAlias, ModerationStatus status, LocalDate dateApproved)
    Creates an instance of a UserDTO record class.
    UserDTO(User user, boolean admin, boolean moderator)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the admin record component.
    Returns the value of the alias record component.
    Returns the value of the dateApproved record component.
    Returns the value of the email record component.
    boolean
    Returns the value of the emailVerified record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the familyName record component.
    Returns the value of the fullName record component.
    Returns the value of the givenName record component.
    Returns the value of the googleSub record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the hostedDomain record component.
    long
    id()
    Returns the value of the id record component.
    Returns the value of the locale record component.
    boolean
    Returns the value of the moderator record component.
    Returns the value of the pictureUrl record component.
    Returns the value of the proposedAlias record component.
    Returns the value of the status record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • UserDTO

      public UserDTO(User user, boolean admin, boolean moderator)
    • UserDTO

      public UserDTO(long id, String email, String googleSub, String pictureUrl, String fullName, String givenName, String familyName, boolean emailVerified, String locale, String hostedDomain, boolean admin, boolean moderator, String alias, String proposedAlias, ModerationStatus status, LocalDate dateApproved)
      Creates an instance of a UserDTO record class.
      Parameters:
      id - the value for the id record component
      email - the value for the email record component
      googleSub - the value for the googleSub record component
      pictureUrl - the value for the pictureUrl record component
      fullName - the value for the fullName record component
      givenName - the value for the givenName record component
      familyName - the value for the familyName record component
      emailVerified - the value for the emailVerified record component
      locale - the value for the locale record component
      hostedDomain - the value for the hostedDomain record component
      admin - the value for the admin record component
      moderator - the value for the moderator record component
      alias - the value for the alias record component
      proposedAlias - the value for the proposedAlias record component
      status - the value for the status record component
      dateApproved - the value for the dateApproved 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 '=='.
      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
    • email

      public String email()
      Returns the value of the email record component.
      Returns:
      the value of the email record component
    • googleSub

      public String googleSub()
      Returns the value of the googleSub record component.
      Returns:
      the value of the googleSub record component
    • pictureUrl

      public String pictureUrl()
      Returns the value of the pictureUrl record component.
      Returns:
      the value of the pictureUrl record component
    • fullName

      public String fullName()
      Returns the value of the fullName record component.
      Returns:
      the value of the fullName record component
    • givenName

      public String givenName()
      Returns the value of the givenName record component.
      Returns:
      the value of the givenName record component
    • familyName

      public String familyName()
      Returns the value of the familyName record component.
      Returns:
      the value of the familyName record component
    • emailVerified

      public boolean emailVerified()
      Returns the value of the emailVerified record component.
      Returns:
      the value of the emailVerified record component
    • locale

      public String locale()
      Returns the value of the locale record component.
      Returns:
      the value of the locale record component
    • hostedDomain

      public String hostedDomain()
      Returns the value of the hostedDomain record component.
      Returns:
      the value of the hostedDomain record component
    • admin

      public boolean admin()
      Returns the value of the admin record component.
      Returns:
      the value of the admin record component
    • moderator

      public boolean moderator()
      Returns the value of the moderator record component.
      Returns:
      the value of the moderator record component
    • alias

      public String alias()
      Returns the value of the alias record component.
      Returns:
      the value of the alias record component
    • proposedAlias

      public String proposedAlias()
      Returns the value of the proposedAlias record component.
      Returns:
      the value of the proposedAlias record component
    • status

      public ModerationStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • dateApproved

      public LocalDate dateApproved()
      Returns the value of the dateApproved record component.
      Returns:
      the value of the dateApproved record component