- java.lang.Object
- 
- models.User
 
- 
- Direct Known Subclasses:
- Student,- Supervisor
 
 public class User extends java.lang.ObjectTheUserclass represents a user in the system. Users have a unique ID, a name, an email address, and a password. Each user also has a role, which determines their level of access to the system.
- 
- 
Field SummaryFields Modifier and Type Field Description private java.lang.StringemailThe email address of the user.private java.lang.StringnameThe name of the user.private java.lang.StringpasswordThe password of the user.private UserRoleroleTheUserRoleof the user.private java.lang.StringuserIDThe ID of the user.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetEmail()Returns the email address of the User.java.lang.StringgetName()Returns the name of the User.java.lang.StringgetPassword()Returns the password of the User.UserRolegetRole()Returns the UserRole of the User.java.lang.StringgetUserID()Returns the user ID of the User.java.lang.BooleansetPassword(java.lang.String oldPassword, java.lang.String newPassword)Sets the password of the user.java.lang.BooleansetRole(UserRole role)Sets the UserRole of the User.
 
- 
- 
- 
Constructor Detail- 
Userpublic User(java.lang.String userID, java.lang.String name, java.lang.String email, java.lang.String password)Constructs aUserobject with given user ID, name, email, and password.- Parameters:
- userID- the ID of the user
- name- the name of the user
- email- the email address of the user
- password- the password of the user
 
 
- 
 - 
Method Detail- 
getUserIDpublic java.lang.String getUserID() Returns the user ID of the User.- Returns:
- the user ID
 
 - 
getPasswordpublic java.lang.String getPassword() Returns the password of the User.- Returns:
- the password
 
 - 
getNamepublic java.lang.String getName() Returns the name of the User.- Returns:
- the name
 
 - 
getEmailpublic java.lang.String getEmail() Returns the email address of the User.- Returns:
- the email address
 
 - 
setRolepublic java.lang.Boolean setRole(UserRole role) Sets the UserRole of the User.- Parameters:
- role- the UserRole to set
- Returns:
- true if UserRole is set successfully
 
 - 
setPasswordpublic java.lang.Boolean setPassword(java.lang.String oldPassword, java.lang.String newPassword)Sets the password of the user. Validates if the oldPassword matches the currentPassword- Parameters:
- oldPassword- the old password to confirm the change
- newPassword- the new password to set
- Returns:
- true if password change is successful, false otherwise
 
 
- 
 
-