java.lang.Object
com.ntu.fdae.group1.bto.models.user.User
Direct Known Subclasses:
Applicant, HDBStaff

public abstract class User extends Object
Abstract base class representing a user in the BTO system.

This class serves as the foundation for all user types in the system, providing common attributes and functionality shared by all users regardless of their specific role. User authentication, personal details, and role-based access control are managed through this class hierarchy.

All users in the system have basic identifying information including NRIC, name, age, and marital status. Authentication is handled through password hashing for security.

See Also:
  • Constructor Details

    • User

      public User(String nric, String passwordHash, String name, int age, MaritalStatus maritalStatus)
      Constructs a new User with the specified details.
      Parameters:
      nric - The NRIC number that uniquely identifies this user
      passwordHash - The hashed password used for authentication
      name - The full name of this user
      age - The age of this user
      maritalStatus - The marital status of this user
  • Method Details

    • getNric

      public String getNric()
      Gets the NRIC number of this user.
      Returns:
      The NRIC number
    • getPasswordHash

      public String getPasswordHash()
      Gets the hashed password of this user.
      Returns:
      The hashed password
    • updatePasswordHash

      public void updatePasswordHash(String passwordHash)
      Sets a new hashed password for this user.
      Parameters:
      passwordHash - The new hashed password
    • getName

      public String getName()
      Gets the full name of this user.
      Returns:
      The user's name
    • getAge

      public int getAge()
      Gets the age of this user.
      Returns:
      The user's age
    • getMaritalStatus

      public MaritalStatus getMaritalStatus()
      Gets the marital status of this user.
      Returns:
      The user's marital status
    • getRole

      public abstract UserRole getRole()
      Gets the role of this user in the system.

      This abstract method must be implemented by all concrete user classes to define their specific role, which determines their permissions and access rights within the system.

      Returns:
      The user's role