Package org.apache.sshd.common.config
Enum TimeValueConfig
- java.lang.Object
-
- java.lang.Enum<TimeValueConfig>
-
- org.apache.sshd.common.config.TimeValueConfig
-
- All Implemented Interfaces:
Serializable
,Comparable<TimeValueConfig>
public enum TimeValueConfig extends Enum<TimeValueConfig>
- Author:
- Apache MINA SSHD Project
- See Also:
- Time formats for SSH configuration values
-
-
Field Summary
Fields Modifier and Type Field Description static Set<TimeValueConfig>
VALUES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static long
durationOf(String s)
static long
durationOf(Map<TimeValueConfig,? extends Number> spec)
static TimeValueConfig
fromValueChar(char ch)
long
getInterval()
char
getLowerCaseValue()
char
getUpperCaseValue()
static Map<TimeValueConfig,Long>
parse(String s)
static TimeValueConfig
valueOf(String name)
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 Detail
-
SECONDS
public static final TimeValueConfig SECONDS
-
MINUTES
public static final TimeValueConfig MINUTES
-
HOURS
public static final TimeValueConfig HOURS
-
DAYS
public static final TimeValueConfig DAYS
-
WEEKS
public static final TimeValueConfig WEEKS
-
-
Field Detail
-
VALUES
public static final Set<TimeValueConfig> VALUES
-
-
Method Detail
-
values
public static TimeValueConfig[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TimeValueConfig c : TimeValueConfig.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TimeValueConfig valueOf(String name)
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
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(String)
,durationOf(Map)
-
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 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
-
-