枚举类 DurationStyle

java.lang.Object
java.lang.Enum<DurationStyle>
org.springframework.boot.convert.DurationStyle
所有已实现的接口:
Serializable, Comparable<DurationStyle>, Constable

public enum DurationStyle extends Enum<DurationStyle>
Duration format styles.
从以下版本开始:
2.0.0
作者:
Phillip Webb, Valentine Wu
  • 枚举常量详细资料

    • SIMPLE

      public static final DurationStyle SIMPLE
      Simple formatting, for example '1s'.
    • ISO8601

      public static final DurationStyle ISO8601
      ISO-8601 formatting.
  • 方法详细资料

    • values

      public static DurationStyle[] values()
      返回包含该枚举类的常量的数组, 顺序与声明这些常量的顺序相同
      返回:
      包含该枚举类的常量的数组,顺序与声明这些常量的顺序相同
    • valueOf

      public static DurationStyle valueOf(String name)
      返回带有指定名称的该类的枚举常量。 字符串必须与用于声明该类的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)
      参数:
      name - 要返回的枚举常量的名称。
      返回:
      返回带有指定名称的枚举常量
      抛出:
      IllegalArgumentException - 如果该枚举类没有带有指定名称的常量
      NullPointerException - 如果参数为空值
    • matches

      protected final boolean matches(String value)
    • matcher

      protected final Matcher matcher(String value)
    • parse

      public Duration parse(String value)
      Parse the given value to a duration.
      参数:
      value - the value to parse
      返回:
      a duration
    • parse

      public abstract Duration parse(String value, ChronoUnit unit)
      Parse the given value to a duration.
      参数:
      value - the value to parse
      unit - the duration unit to use if the value doesn't specify one (null will default to ms)
      返回:
      a duration
    • print

      public String print(Duration value)
      Print the specified duration.
      参数:
      value - the value to print
      返回:
      the printed result
    • print

      public abstract String print(Duration value, ChronoUnit unit)
      Print the specified duration using the given unit.
      参数:
      value - the value to print
      unit - the value to use for printing
      返回:
      the printed result
    • detectAndParse

      public static Duration detectAndParse(String value)
      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

      public static Duration detectAndParse(String value, ChronoUnit unit)
      Detect the style then parse the value to return a duration.
      参数:
      value - the value to parse
      unit - the duration unit to use if the value doesn't specify one (null will default to ms)
      返回:
      the parsed duration
      抛出:
      IllegalArgumentException - if the value is not a known style or cannot be parsed
    • detect

      public static DurationStyle detect(String value)
      Detect the style from the given source value.
      参数:
      value - the source value
      返回:
      the duration style
      抛出:
      IllegalArgumentException - if the value is not a known style