Class DurationSerializer

All Implemented Interfaces:
JsonFormatVisitable, SchemaAware, ContextualSerializer, Serializable

public class DurationSerializer extends StdSerializer<T>
Serializer for Java 8 temporal Durations.

NOTE: since 2.10, SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS determines global default used for determining if serialization should use numeric (timestamps) or textual representation. Before this, SerializationFeature.WRITE_DATES_AS_TIMESTAMPS was used.

Since:
2.2
Author:
Nick Williams
See Also:
  • Field Details

    • INSTANCE

      public static final DurationSerializer INSTANCE
    • _useTimestamp

      protected final Boolean _useTimestamp
      Flag that indicates that serialization must be done as the Java timestamp, regardless of other settings.
    • _useNanoseconds

      protected final Boolean _useNanoseconds
      Flag that indicates that numeric timestamp values must be written using nanosecond timestamps if the datatype supports such resolution, regardless of other settings.
    • _formatter

      protected final DateTimeFormatter _formatter
      Specific format to use, if not default format: non null value also indicates that serialization is to be done as JSON String, not numeric timestamp, unless #_useTimestamp is true.
    • _shape

      protected final JsonFormat.Shape _shape
    • _integerListType

      protected transient volatile JavaType _integerListType
      Lazily constructed JavaType representing type List<Integer>.
      Since:
      2.10
  • Constructor Details

  • Method Details