Record Class ServerUser

java.lang.Object
java.lang.Record
eirb.pub.app.server.utils.ServerUser

public record ServerUser(UUID uuid, String email, String name, PublicKey publicKey) extends Record
  • Constructor Details

    • ServerUser

      public ServerUser(UUID uuid, String email, String name, PublicKey publicKey)
      Creates an instance of a ServerUser record class.
      Parameters:
      uuid - the value for the uuid record component
      email - the value for the email record component
      name - the value for the name record component
      publicKey - the value for the publicKey record component
  • Method Details

    • byID

      Retrieve a user based on its id
      Parameters:
      uuid - uuid of the desired user
      sa - ServerAuthentication to fetch information
      Returns:
      the serverUser linked to this id
      Throws:
      AuthenticationException - if the authentication failed
      TimeoutException - if the request took too much time to complete
      IOException - the connection failed during the process
      ServerException
    • byEmail

      Retrieve a user based on its email
      Parameters:
      email - email of the desired user
      sa - ServerAuthentication to fetch information
      Returns:
      the serverUser linked to this email
      Throws:
      AuthenticationException - if the authentication failed
      TimeoutException - if the request took too much time to complete
      IOException - the connection failed during the process
      ServerException
    • fromJSON

      public static ServerUser fromJSON(org.json.JSONObject response)
      Parse a JSON response to get a ServerUser
      Parameters:
      response - response of the server
      Returns:
      ServerUser represented by the jsonObject
    • equals

      public boolean equals(Object object)
      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:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • 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
    • uuid

      public UUID uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • email

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

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • publicKey

      public PublicKey publicKey()
      Returns the value of the publicKey record component.
      Returns:
      the value of the publicKey record component