Package example.app.entities.users
Class User
java.lang.Object
example.app.entities.users.User
- All Implemented Interfaces:
FileDatabaseCompatible,Serializable
- Direct Known Subclasses:
FacultyUser
Class User
- This class represents a user account.
- Each user has a unique ID (UUID v4) assigned to them which cannot be changed.
- Each user has a account creation date assigned to them at the time of their account creation.
- The password for each user is stored in a byte array, which is created by the encrypting the
- password with SHA512 algorithm.
- If two user have same username, then they are considered equal, else they aren't
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancredentialsEquals(String username, String password) This method checks if a given username and password are equal to the user or notbooleanGetter for the account creation dategetEmail()Getter for the emailGetter for the first namegetId()Getter for the IDGetter for the last nameGetter for the usernameinthashCode()booleanpasswordEquals(String password) This method checks if a password is equal to the password of the user or notvoidSetter for the emailvoidsetFirstName(String firstName) Setter for the first namevoidsetLastName(String lastName) Setter for the last namevoidsetPassword(String password) Setter for the passwordvoidsetUsername(String username) Setter for the usernametoString()booleanusernameEquals(String username) This method checks if a username is equal to the username of the user or not
-
Method Details
-
getId
Getter for the ID- Specified by:
getIdin interfaceFileDatabaseCompatible- Returns:
- The id of the user
-
getUsername
Getter for the username- Returns:
- The username of the user
-
setUsername
Setter for the username- Parameters:
username- The username of the user- Throws:
NullArgumentException- If the username is nullEmptyArgumentException- If the username is empty
-
setPassword
Setter for the password- Parameters:
password- The password of the user- Throws:
NullArgumentException- If the password is nullEmptyArgumentException- If the password is empty
-
getFirstName
Getter for the first name- Returns:
- the first name
-
setFirstName
Setter for the first name- Parameters:
firstName- The first name of the user- Throws:
NullArgumentException- If the first name is nullEmptyArgumentException- If the first name is empty
-
getLastName
Getter for the last name- Returns:
- the last name
-
setLastName
Setter for the last name- Parameters:
lastName- The last name of the user- Throws:
NullArgumentException- If the last name is nullEmptyArgumentException- If the last name is empty
-
getEmail
Getter for the email- Returns:
- The email of the user
-
setEmail
Setter for the email- Parameters:
email- The email of the user- Throws:
NullArgumentException- If the email is nullEmptyArgumentException- If the email is empty
-
getCreationDate
Getter for the account creation date- Specified by:
getCreationDatein interfaceFileDatabaseCompatible- Returns:
- The account creation date
-
usernameEquals
This method checks if a username is equal to the username of the user or not- Parameters:
username- The username to be checked- Returns:
- true if the username is equal to the username of the user, false otherwise
-
passwordEquals
This method checks if a password is equal to the password of the user or not- Parameters:
password- The password to be checked- Returns:
- true if the password is equal to the password of the user, false otherwise
-
credentialsEquals
This method checks if a given username and password are equal to the user or not- Parameters:
username- The username to be checkedpassword- The password to be checked- Returns:
- true if the username and password are equal to the user, false otherwise
-
equals
-
hashCode
public int hashCode() -
toString
-