Annotation Interface DurationSerializationFormat


@Inherited @Documented @Retention(RUNTIME) @Target(FIELD) public @interface DurationSerializationFormat
Annotation to specify the formatting unit for durations. This annotation can be applied to fields to indicate the ChronoUnit that governs how durations should be interpreted or formatted.

You would use it like this:


   @JsonProperty("timeout")
   @JsonSerialize(using = Jackson2DurationSerializer.class)
   @tools.jackson.databind.annotation.JsonSerialize(using = Jackson3DurationSerializer.class)
   @DurationSerializationFormat(ChronoUnit.SECONDS)
   @Nullable
   private Duration timeout;
   
   
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specifies the unit of time to be used for formatting durations.
  • Element Details

    • value

      ChronoUnit value
      Specifies the unit of time to be used for formatting durations.
      Returns:
      the ChronoUnit representing the unit of time for formatting durations