Class Profile


public final class Profile extends TimestampedEntity
Represents a user's profile in the system. Contains personal information, contact details, and metadata related to the user's account. Each Profile is associated with exactly one User.

The Profile class extends TimestampedEntity, which automatically provides createdAt and updatedAt timestamps.

Fields include:

  • firstName - The user's first name (optional).
  • lastName - The user's last name (optional).
  • phone - The user's phone number (optional).
  • country - The user's country (optional).
  • state - The user's state/region (optional).
  • aboutMe - A short biography or description (optional).
  • username - Auto-generated unique username, immutable after creation.
  • profileImageUrl - Optional URL to the user's profile image.
  • user - The User this profile belongs to.

NOTE: The username field is generated automatically when the profile is created and cannot be modified manually. This ensures uniqueness across the system.

NOTE: This class is declared final to prevent inheritance and ensure session integrity.

Since:
2026-02-03
Version:
1.0
Author:
@ZouariOmar (zouariomar20@gmail.com)
See Also:
  • Constructor Details

    • Profile

      public Profile()
      Creates an empty user profile entity.
  • Method Details

    • getUsername

      public String getUsername()
      Returns the unique username.
      Returns:
      username value
    • setUsername

      public void setUsername(String username)
      Sets the unique username.
      Parameters:
      username - username value
    • getFirstName

      public String getFirstName()
      Returns the first name.
      Returns:
      first name
    • setFirstName

      public void setFirstName(String firstName)
      Sets the first name.
      Parameters:
      firstName - first name
    • getLastName

      public String getLastName()
      Returns the last name.
      Returns:
      last name
    • setLastName

      public void setLastName(String lastName)
      Sets the last name.
      Parameters:
      lastName - last name
    • getPhone

      public String getPhone()
      Returns the phone number.
      Returns:
      phone number
    • setPhone

      public void setPhone(String phone)
      Sets the phone number.
      Parameters:
      phone - phone number
    • getGender

      public Gender getGender()
      Returns the gender.
      Returns:
      gender value
    • setGender

      public void setGender(Gender gender)
      Sets the gender.
      Parameters:
      gender - gender value
    • getProfileImageUrl

      public String getProfileImageUrl()
      Returns the profile image URL.
      Returns:
      profile image URL
    • setProfileImageUrl

      public void setProfileImageUrl(String profileImageUrl)
      Sets the profile image URL.
      Parameters:
      profileImageUrl - profile image URL
    • getCountry

      public String getCountry()
      Returns the country.
      Returns:
      country value
    • setCountry

      public void setCountry(String country)
      Sets the country.
      Parameters:
      country - country value
    • getState

      public String getState()
      Returns the state/region.
      Returns:
      state or region
    • setState

      public void setState(String state)
      Sets the state/region.
      Parameters:
      state - state or region
    • getAboutMe

      public String getAboutMe()
      Returns the short biography text.
      Returns:
      about-me text
    • setAboutMe

      public void setAboutMe(String aboutMe)
      Sets the short biography text.
      Parameters:
      aboutMe - about-me text
    • getUser

      public User getUser()
      Returns the owning user.
      Returns:
      owning user
    • setUser

      public void setUser(User user)
      Sets the owning user.
      Parameters:
      user - owning user