Package org.apache.sshd.common.config
Enum TimeValueConfig
- java.lang.Object
-
- java.lang.Enum<TimeValueConfig>
-
- org.apache.sshd.common.config.TimeValueConfig
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<TimeValueConfig>
public enum TimeValueConfig extends java.lang.Enum<TimeValueConfig>
-
-
Field Summary
Fields Modifier and Type Field Description private char
hiChar
private long
interval
private char
loChar
static java.util.Set<TimeValueConfig>
VALUES
-
Constructor Summary
Constructors Modifier Constructor Description private
TimeValueConfig(char lo, char hi, long interval)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static long
durationOf(java.lang.String s)
static long
durationOf(java.util.Map<TimeValueConfig,? extends java.lang.Number> spec)
static TimeValueConfig
fromValueChar(char ch)
long
getInterval()
char
getLowerCaseValue()
char
getUpperCaseValue()
static java.util.Map<TimeValueConfig,java.lang.Long>
parse(java.lang.String s)
static TimeValueConfig
valueOf(java.lang.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 java.util.Set<TimeValueConfig> VALUES
-
loChar
private final char loChar
-
hiChar
private final char hiChar
-
interval
private final long interval
-
-
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(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.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(java.lang.String s)
- Parameters:
s
- A time specification- Returns:
- The specified duration in milliseconds
- See Also:
parse(String)
,durationOf(Map)
-
parse
public static java.util.Map<TimeValueConfig,java.lang.Long> parse(java.lang.String s) throws java.lang.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:
java.lang.NumberFormatException
- If bad numbers found - e.g., negative countsjava.lang.IllegalArgumentException
- If bad format - e.g., unknown unit
-
durationOf
public static long durationOf(java.util.Map<TimeValueConfig,? extends java.lang.Number> spec) throws java.lang.IllegalArgumentException
- Parameters:
spec
- TheMap
specifying the count for eachTimeValueConfig
- Returns:
- The total duration in milliseconds
- Throws:
java.lang.IllegalArgumentException
- If negative count for a time unit
-
-