Class User
java.lang.Object
com.ntu.fdae.group1.bto.models.user.User
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 Summary
ConstructorsConstructorDescriptionUser
(String nric, String passwordHash, String name, int age, MaritalStatus maritalStatus) Constructs a new User with the specified details. -
Method Summary
Modifier and TypeMethodDescriptionint
getAge()
Gets the age of this user.Gets the marital status of this user.getName()
Gets the full name of this user.getNric()
Gets the NRIC number of this user.Gets the hashed password of this user.abstract UserRole
getRole()
Gets the role of this user in the system.void
updatePasswordHash
(String passwordHash) Sets a new hashed password for this user.
-
Constructor Details
-
User
Constructs a new User with the specified details.- Parameters:
nric
- The NRIC number that uniquely identifies this userpasswordHash
- The hashed password used for authenticationname
- The full name of this userage
- The age of this usermaritalStatus
- The marital status of this user
-
-
Method Details
-
getNric
Gets the NRIC number of this user.- Returns:
- The NRIC number
-
getPasswordHash
Gets the hashed password of this user.- Returns:
- The hashed password
-
updatePasswordHash
Sets a new hashed password for this user.- Parameters:
passwordHash
- The new hashed password
-
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
Gets the marital status of this user.- Returns:
- The user's marital status
-
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
-