Package org.apache.sshd.common.config
Enum TimeValueConfig
- All Implemented Interfaces:
Serializable
,Comparable<TimeValueConfig>
- See Also:
-
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic long
durationOf
(String s) static long
durationOf
(Map<TimeValueConfig, ? extends Number> spec) static TimeValueConfig
fromValueChar
(char ch) final long
final char
final char
static Map
<TimeValueConfig, Long> static TimeValueConfig
Returns the enum constant of this type with the specified name.static TimeValueConfig[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
SECONDS
-
MINUTES
-
HOURS
-
DAYS
-
WEEKS
-
-
Field Details
-
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
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getLowerCaseValue
public final char getLowerCaseValue() -
getUpperCaseValue
public final char getUpperCaseValue() -
getInterval
public final long getInterval() -
fromValueChar
-
durationOf
- Parameters:
s
- A time specification- Returns:
- The specified duration in milliseconds
- See Also:
-
parse
- 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 countsIllegalArgumentException
- If bad format - e.g., unknown unit
-
durationOf
public static long durationOf(Map<TimeValueConfig, ? extends Number> spec) throws IllegalArgumentException- Parameters:
spec
- TheMap
specifying the count for eachTimeValueConfig
- Returns:
- The total duration in milliseconds
- Throws:
IllegalArgumentException
- If negative count for a time unit
-