Package org.springframework.format.annotation

# Enum Class DurationFormat.Style

java.lang.Object
java.lang.Enum<DurationFormat.Style>
org.springframework.format.annotation.DurationFormat.Style

All Implemented Interfaces:
  `Serializable`, `Comparable<DurationFormat.Style>`, `Constable`

Enclosing class:
  DurationFormat

public static enum DurationFormat.Style extends Enum<DurationFormat.Style>
`Duration` format styles.

## Nested Class Summary

## Nested classes/interfaces inherited from class java.lang.Enum

`Enum.EnumDesc<E extends Enum<E>>`

## Enum Constant Summary

Enum Constants
Enum Constant
Description
`COMPOSITE`
Like `SIMPLE`, but allows multiple segments ordered from largest-to-smallest units of time, like `1h12m27s`.
`ISO8601`
ISO-8601 formatting.
`SIMPLE`
Simple formatting based on a short suffix, for example '1s'.

## Method Summary

Modifier and Type
Method
Description
`static DurationFormat.Style`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static DurationFormat.Style[]`
`values()`
Returns an array containing the constants of this enum class, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Enum Constant Details

### ISO8601

public static final DurationFormat.Style ISO8601
ISO-8601 formatting.

This is what the JDK uses in `Duration.parse(CharSequence)` and `Duration.toString()`.

### SIMPLE

public static final DurationFormat.Style SIMPLE
Simple formatting based on a short suffix, for example '1s'.

Supported unit suffixes include: `ns, us, ms, s, m, h, d`. Those correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, hours, and days, respectively.

Note that when printing a `Duration`, this style can be lossy if the selected unit is bigger than the resolution of the duration. For example, `Duration.ofMillis(5).plusNanos(1234)` would get truncated to `"5ms"` when printing using `ChronoUnit.MILLIS`.

Fractional durations are not supported.

### COMPOSITE

public static final DurationFormat.Style COMPOSITE
Like `SIMPLE`, but allows multiple segments ordered from largest-to-smallest units of time, like `1h12m27s`.

A single minus sign (`-`) is allowed to indicate the whole duration is negative. Spaces are allowed between segments, and a negative duration with spaced segments can optionally be surrounded by parentheses after the minus sign, like so: `-(34m 57s)`.

## Method Details

### values

public static DurationFormat.Style[] 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

public static DurationFormat.Style 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.)

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 name
  `NullPointerException` - if the argument is null