Enum Class TimeValueConfig

java.lang.Object
java.lang.Enum<TimeValueConfig>
org.apache.sshd.common.config.TimeValueConfig
All Implemented Interfaces:
Serializable, Comparable<TimeValueConfig>, Constable

public enum TimeValueConfig extends Enum<TimeValueConfig>
See Also:
  • Enum Constant Details

  • Field Details

    • VALUES

      public static final Set<TimeValueConfig> VALUES
    • loChar

      private final char loChar
    • hiChar

      private final char hiChar
    • interval

      private final long interval
  • Constructor Details

    • TimeValueConfig

      private TimeValueConfig(char lo, char hi, long interval)
  • Method Details

    • values

      public static TimeValueConfig[] 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 TimeValueConfig 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
    • getLowerCaseValue

      public final char getLowerCaseValue()
    • getUpperCaseValue

      public final char getUpperCaseValue()
    • getInterval

      public final long getInterval()
    • fromValueChar

      public static TimeValueConfig fromValueChar(char ch)
    • durationOf

      public static long durationOf(String s)
      Parameters:
      s - A time specification
      Returns:
      The specified duration in milliseconds
      See Also:
    • parse

      public static Map<TimeValueConfig,Long> parse(String s) throws IllegalArgumentException
      Parameters:
      s - An input time specification containing possibly mixed numbers and units - e.g., 3h10m to indicate 3 hours and 10 minutes
      Returns:
      A Map specifying for each time unit its count
      Throws:
      NumberFormatException - If bad numbers found - e.g., negative counts
      IllegalArgumentException - If bad format - e.g., unknown unit
    • durationOf

      public static long durationOf(Map<TimeValueConfig,? extends Number> spec) throws IllegalArgumentException
      Parameters:
      spec - The Map specifying the count for each TimeValueConfig
      Returns:
      The total duration in milliseconds
      Throws:
      IllegalArgumentException - If negative count for a time unit