列挙型クラス DurationFormat.Unit

java.lang.ObjectSE
java.lang.EnumSE<DurationFormat.Unit>
org.springframework.format.annotation.DurationFormat.Unit
実装されたすべてのインターフェース:
SerializableSEComparableSE<DurationFormat.Unit>ConstableSE
含まれているクラス:
DurationFormat

public static enum DurationFormat.Unit extends EnumSE<DurationFormat.Unit>
DurationSE 形式の単位。ChronoUnitSE のサブセットを反映し、サポートされている ChronoUnit との間の変換、および期間から long への変換を可能にします。

列挙型には、SIMPLE Duration 形式スタイルの対応するサフィックスが含まれます。

  • 列挙型定数の詳細

  • メソッドの詳細

    • values

      public static DurationFormat.Unit[] values()
      この列挙型クラスの定数を含む配列を、宣言されている順序で返します。
      戻り値:
      この列挙型クラスの定数を宣言された順序で含む配列
    • valueOf

      public static DurationFormat.Unit valueOf(StringSE name)
      指定された名前でこのクラスの列挙型定数を返します。文字列は、このクラスで列挙型定数を宣言するために使用される識別子と正確に一致する必要があります。(余分な空白文字は許可されません。)
      パラメーター:
      name - 返される列挙定数の名前。
      戻り値:
      指定された名前の列挙定数
      例外:
      IllegalArgumentExceptionSE - この列挙型クラスに指定された名前の定数がない場合
      NullPointerExceptionSE - 引数が null の場合
    • asChronoUnit

      public ChronoUnitSE asChronoUnit()
      この Unit を同等の ChronoUnitSE に変換します。
    • asSuffix

      public StringSE asSuffix()
      この Unit を、SIMPLE スタイルに適した単純な String サフィックスに変換します。
    • parse

      public DurationSE parse(StringSE value)
      指定された StringSE から long を解析し、それを現在のユニットの DurationSE として解釈します。
      パラメーター:
      value - 長い String 表現
      戻り値:
      対応する Duration
    • print

      public StringSE print(DurationSE value)
      指定された DurationSEStringSE として出力し、longValue(Duration) を介してこの単位の精度を使用して long 値に変換し、この単位の単純な suffix を追加します。
      パラメーター:
      value - Duration を String に変換する
      戻り値:
      Duration の String 表現を SIMPLE スタイルで表したもの
    • longValue

      public long longValue(DurationSE value)
      指定された DurationSE をこの単位の解決の long 値に変換します。

      Note that this can be lossy if the current unit is bigger than the actual resolution of the duration. For example, Duration.ofMillis(5).plusNanos(1234) would get truncated to 5 for unit MILLIS.

      パラメーター:
      value - the Duration to convert to a long
      戻り値:
      the long value for the Duration in this Unit
    • fromChronoUnit

      public static DurationFormat.Unit fromChronoUnit(@Nullable ChronoUnitSE chronoUnit)
      指定された ChronoUnitSE に対応する DurationFormat.Unit を取得します。
      例外:
      IllegalArgumentExceptionSE - if the given ChronoUnit is not supported
    • fromSuffix

      public static DurationFormat.Unit fromSuffix(StringSE suffix)
      指定された StringSE サフィックスに対応する DurationFormat.Unit を取得します。
      例外:
      IllegalArgumentExceptionSE - if the given suffix is not supported