Package com.j_spaces.kernel
Enum Class TimeUnitProperty
- All Implemented Interfaces:
Serializable,Comparable<TimeUnitProperty>,java.lang.constant.Constable
Helper class that converts time interval property to milliseconds long value, according to the
given time unit format ms - milliseconds s - seconds m - minutes h - hours
- Since:
- 6.1
- Author:
- anna
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic longgetParsedValue(String time) static longgetParsedValue(String time, TimeUnitProperty defaultTimeUnit) Parse the time using the provided TimeUnitProperty.static longgetProperty(String key, String def) Get the property from the system properties and parse it according the matching pattern.static longgetProperty(String key, String def, TimeUnitProperty defaultTimeUnit) Get the property from the system properties and parse it according the matching patternstatic TimeUnitPropertyReturns the enum constant of this class with the specified name.static TimeUnitProperty[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MILLISECONDS
-
SECONDS
-
MINUTES
-
HOURS
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getProperty
Get the property from the system properties and parse it according the matching pattern. Default time unit is seconds- Returns:
- system property according the matching pattern
-
getProperty
Get the property from the system properties and parse it according the matching pattern- Returns:
- timeValue
-
getParsedValue
Parse the time using the provided TimeUnitProperty. This method does not get the value from system properties but instead uses the passed value and returns a long representation. -
getParsedValue
-