Annotation Interface DurationFormat
@Documented
@Retention(RUNTIME)
@Target({METHOD,FIELD,PARAMETER,ANNOTATION_TYPE})
public @interface DurationFormat
Declares that a field or method parameter should be formatted as a
Duration
, according to the specified style
.- Since:
- 6.2
- Author:
- Simon Baslé
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Duration format styles.static enum
Duration format unit, which mirrors a subset ofChronoUnit
and allows conversion to and from a supportedChronoUnit
as well as conversion from durations to longs. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionTheDurationFormat.Unit
to fall back to in case thestyle()
needs a unit for either parsing or printing, and none is explicitly provided in the input.TheStyle
to use for parsing and printing aDuration
.
-
Element Details
-
style
DurationFormat.Style styleTheStyle
to use for parsing and printing aDuration
.Defaults to the JDK style (
DurationFormat.Style.ISO8601
).- Default:
- ISO8601
-
defaultUnit
DurationFormat.Unit defaultUnitTheDurationFormat.Unit
to fall back to in case thestyle()
needs a unit for either parsing or printing, and none is explicitly provided in the input.Defaults to
DurationFormat.Unit.MILLIS
if unspecified.- Default:
- MILLIS
-