Class User

java.lang.Object
com.randomnoun.common.security.User
All Implemented Interfaces:
Serializable

public class User extends Object implements Serializable
A class encapsulating information to define an end-user.
Author:
knoxg
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object object)
    Two users are considered identical if their customerIds and usernames are identical
    long
    Returns the customerId partly identifying this user.
    Returns the locale for this user.
    long
    Returns the userId for this user
    Returns the username partly identifying this user.
    int
    Must override hasCode() if we override equals().
    void
    setCustomerId(long customerId)
    Sets the customerId that partly identifies this user.
    void
    setLocale(Locale locale)
    Sets the locale for this user.
    void
    setUserId(long userId)
    Sets the userId for this user
    void
    setUsername(String username)
    Sets the username that partly identifies this user.
    Returns a string representation of this user (used for debugging only).

    Methods inherited from class java.lang.Object

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

    • User

      public User()
  • Method Details

    • setUsername

      public void setUsername(String username)
      Sets the username that partly identifies this user. (Within a realm, both username and customerId must be used to uniquely identify a user).
      Parameters:
      value - the username for this user
    • getUsername

      public String getUsername()
      Returns the username partly identifying this user. (Within a realm, both username and customerId must be used to uniquely identify a user).
      Returns:
      the username for this user.
    • setCustomerId

      public void setCustomerId(long customerId)
      Sets the customerId that partly identifies this user. (Both username and customerId must be used to uniquely identify a user).
      Parameters:
      value - the customerId for this user
    • getCustomerId

      public long getCustomerId()
      Returns the customerId partly identifying this user. (Both username and customerId must be used to uniquely identify a user).
      Returns:
      the customerId for this user.
    • setLocale

      public void setLocale(Locale locale)
      Sets the locale for this user. The locale is used to localise text that will be sent to the user.
      Parameters:
      value - the locale for this user
    • getLocale

      public Locale getLocale()
      Returns the locale for this user.
      Returns:
      the locale for this user.
    • setUserId

      public void setUserId(long userId)
      Sets the userId for this user
      Parameters:
      userId - the userId for this user
    • getUserId

      public long getUserId()
      Returns the userId for this user
      Returns:
      the userId the userId for this user
    • toString

      public String toString()
      Returns a string representation of this user (used for debugging only). This representation includes the username, customerId, roles and permissions stored for this user
      Overrides:
      toString in class Object
      Returns:
      a string representation of this user
    • equals

      public boolean equals(Object object)
      Two users are considered identical if their customerIds and usernames are identical
      Overrides:
      equals in class Object
      Parameters:
      object - the other object used in the comparison
      Returns:
      true if the users are considered identical
    • hashCode

      public int hashCode()
      Must override hasCode() if we override equals().
      Overrides:
      hashCode in class Object
      Returns:
      a hash which will return identical values for identical users (as determined by .equals())