Enum Class DurationStyle

java.lang.Object
java.lang.Enum<DurationStyle>
cn.taketoday.format.annotation.DurationStyle
所有已实现的接口:
Serializable, Comparable<DurationStyle>, Constable

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

    • 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()
      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

      public static DurationStyle valueOf(String name)
      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 name
      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, @Nullable 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, @Nullable 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, @Nullable 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