Enum Class ExpirationTimeUnit

java.lang.Object
java.lang.Enum<ExpirationTimeUnit>
tech.lastbox.jwt.ExpirationTimeUnit
All Implemented Interfaces:
Serializable, Comparable<ExpirationTimeUnit>, Constable

public enum ExpirationTimeUnit extends Enum<ExpirationTimeUnit>
Enum representing various time units for expiration (Days, Hours, Minutes, Seconds). This enum is used to define the unit of time that will be used for token expiration. Each constant corresponds to a specific ChronoUnit.
See Also:
  • Enum Constant Details

    • DAYS

      public static final ExpirationTimeUnit DAYS
      Represents the time unit in days.
    • HOURS

      public static final ExpirationTimeUnit HOURS
      Represents the time unit in hours.
    • MINUTES

      public static final ExpirationTimeUnit MINUTES
      Represents the time unit in minutes.
    • SECONDS

      public static final ExpirationTimeUnit SECONDS
      Represents the time unit in seconds.
  • Method Details

    • values

      public static ExpirationTimeUnit[] 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 ExpirationTimeUnit 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
    • getChronoUnit

      public ChronoUnit getChronoUnit()
      Returns the ChronoUnit associated with this expiration time unit.
      Returns:
      the corresponding ChronoUnit.
    • toDuration

      public Duration toDuration(long amount)
      Converts the given amount of time to a Duration using this expiration time unit.
      Parameters:
      amount - the amount of time.
      Returns:
      a Duration representing the specified amount of time.