Enum Class DurationStyle
- 所有已实现的接口:
Serializable,Comparable<DurationStyle>,Constable
Duration format styles.
- 从以下版本开始:
- 4.0
- 作者:
- Phillip Webb
-
嵌套类概要
嵌套类从类继承的嵌套类/接口 java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
枚举常量概要
枚举常量 -
方法概要
修饰符和类型方法说明static DurationStyleDetect the style from the given source value.static DurationdetectAndParse(String value) Detect the style then parse the value to return a duration.static DurationdetectAndParse(String value, ChronoUnit unit) Detect the style then parse the value to return a duration.protected final Matcherprotected final booleanParse the given value to a duration.abstract Durationparse(String value, ChronoUnit unit) Parse the given value to a duration.Print the specified duration.abstract Stringprint(Duration value, ChronoUnit unit) Print the specified duration using the given unit.static DurationStyleReturns the enum constant of this class with the specified name.static DurationStyle[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
枚举常量详细资料
-
SIMPLE
Simple formatting, for example '1s'. -
ISO8601
ISO-8601 formatting.
-
-
方法详细资料
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- 返回:
- 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.)- 参数:
name- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- 如果参数为空值
-
matches
-
matcher
-
parse
Parse the given value to a duration.- 参数:
value- the value to parse- 返回:
- a duration
-
parse
Parse the given value to a duration.- 参数:
value- the value to parseunit- the duration unit to use if the value doesn't specify one (nullwill default to ms)- 返回:
- a duration
-
print
Print the specified duration.- 参数:
value- the value to print- 返回:
- the printed result
-
print
Print the specified duration using the given unit.- 参数:
value- the value to printunit- the value to use for printing- 返回:
- the printed result
-
detectAndParse
Detect the style then parse the value to return a duration.- 参数:
value- the value to parse- 返回:
- the parsed duration
- 抛出:
IllegalArgumentException- if the value is not a known style or cannot be parsed
-
detectAndParse
Detect the style then parse the value to return a duration.- 参数:
value- the value to parseunit- the duration unit to use if the value doesn't specify one (nullwill default to ms)- 返回:
- the parsed duration
- 抛出:
IllegalArgumentException- if the value is not a known style or cannot be parsed
-
detect
Detect the style from the given source value.- 参数:
value- the source value- 返回:
- the duration style
- 抛出:
IllegalArgumentException- if the value is not a known style
-