Enum Class SessionDuration

java.lang.Object
java.lang.Enum<SessionDuration>
com.serinity.accesscontrol.flag.SessionDuration
All Implemented Interfaces:
Serializable, Comparable<SessionDuration>, Constable

public enum SessionDuration extends Enum<SessionDuration>
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.

Instant expiresAt = SessionDuration.PATIENT_SESSION.fromNow();
Since:
2026-02-17 SessionDuration.java
Version:
1.0
Author:
@ZouariOmar
  • Enum Constant Details

    • ADMIN_SESSION

      public static final SessionDuration ADMIN_SESSION
      Session duration for admin users (days).
    • USER_SESSION

      public static final SessionDuration USER_SESSION
      Session duration for standard users (days).
  • Method Details

    • values

      public static SessionDuration[] 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

      public static SessionDuration valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getDuration

      public long getDuration()
      Returns this duration in days.
      Returns:
      session duration in days
    • toString

      public String toString()
      Overrides:
      toString in class Enum<SessionDuration>