Enum Class SessionDuration
- All Implemented Interfaces:
Serializable, Comparable<SessionDuration>, Constable
Represents predefined durations for sessions, tokens, or other timed events.
Each enum constant defines a specific duration that can be used to calculate expiration times in the system.
ADMIN_SESSION- Admin sessions expire after 1 dayUSER_SESSION- Therapist/Patient sessions expire after 7 days
Instant expiresAt = SessionDuration.PATIENT_SESSION.fromNow();
- Since:
- 2026-02-17 SessionDuration.java
- Version:
- 1.0
- Author:
- @ZouariOmar
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSession duration for admin users (days).Session duration for standard users (days). -
Method Summary
Modifier and TypeMethodDescriptionlongReturns this duration in days.toString()static SessionDurationReturns the enum constant of this class with the specified name.static SessionDuration[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ADMIN_SESSION
Session duration for admin users (days). -
USER_SESSION
Session duration for standard users (days).
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getDuration
public long getDuration()Returns this duration in days.- Returns:
- session duration in days
-
toString
- Overrides:
toStringin classEnum<SessionDuration>
-