Durations.Note
since 2.10, DateTimeFeature#WRITE_DURATIONS_AS_TIMESTAMPS
determines global default used for determining if serialization should use
numeric (timestamps) or textual representation. Before this,
DateTimeFeature#WRITE_DATES_AS_TIMESTAMPS was used.
| Modifier and Type | Field and Description |
|---|---|
| private DurationUnitConverter | _durationUnitConverter
When defined (not |
| public static final DurationSerializer |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | |
| protected | DurationSerializer(DurationSerializer base, DateTimeFormatter dtf, Boolean useTimestamp, Boolean useNanoseconds)
|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| private BigDecimal | |
| protected DateTimeFormatter | |
| public ValueSerializer | createContextual(SerializationContext ctxt, BeanProperty property)
Overrides tools. Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property (or, for root values, in which case `null` is passed). |
| protected DateTimeFeature | getTimestampsFeature()
Overrides tools. Overridable method that determines |
| protected JsonToken | serializationShape(SerializationContext ctxt)
Implements abstract tools. Overridable helper method used from |
| public void | serialize(Duration duration, JsonGenerator generator, SerializationContext ctxt)
Implements abstract tools. Method that can be called to ask implementation to serialize values of type this serializer handles. |
| protected DurationSerializer | |
| protected JSR310FormattedSerializerBase | withFeatures(Boolean writeZoneId, Boolean writeNanoseconds)
Overrides tools.
|
| protected DurationSerializer | withFormat(DateTimeFormatter dtf, Boolean useTimestamp, JsonFormat.
Implements abstract tools.
|
| _durationUnitConverter | back to summary |
|---|---|
| private DurationUnitConverter _durationUnitConverter When defined (not
| |
| INSTANCE | back to summary |
|---|---|
| public static final DurationSerializer INSTANCE | |
| DurationSerializer | back to summary |
|---|---|
| protected DurationSerializer() | |
| DurationSerializer | back to summary |
|---|---|
| protected DurationSerializer(DurationSerializer base, DateTimeFormatter dtf, Boolean useTimestamp) | |
| DurationSerializer | back to summary |
|---|---|
| protected DurationSerializer(DurationSerializer base, DateTimeFormatter dtf, Boolean useTimestamp, Boolean useNanoseconds) | |
| DurationSerializer | back to summary |
|---|---|
| protected DurationSerializer(DurationSerializer base, DurationUnitConverter converter) | |
| _acceptTimestampVisitor | back to summary |
|---|---|
| protected void _acceptTimestampVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) Overrides tools.
| |
| _toNanos | back to summary |
|---|---|
| private BigDecimal _toNanos(Duration duration) | |
| _useDateTimeFormatter | back to summary |
|---|---|
| protected DateTimeFormatter _useDateTimeFormatter(SerializationContext ctxt, JsonFormat. Overrides tools.
| |
| createContextual | back to summary |
|---|---|
| public ValueSerializer Overrides tools. Doc from tools. Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property (or, for root values, in which case `null` is passed). Note that instance that this method is called on is typically shared one and as a result method should NOT modify this instance but rather construct and return a new instance. This instance should only be returned as-is, in case it is already suitable for use. Note that method is only called once per POJO property, and for the first usage as root value serializer; it is not called for every serialization, as doing that would have significant performance impact; most serializers cache contextual instances for future use.
| |
| getTimestampsFeature | back to summary |
|---|---|
| protected DateTimeFeature getTimestampsFeature() Overrides tools. Doc from tools. Overridable method that determines Note that this feature is just the baseline setting and may be overridden on per-type or per-property basis.
| |
| serializationShape | back to summary |
|---|---|
| protected JsonToken serializationShape(SerializationContext ctxt) Implements abstract tools. Doc from tools. Overridable helper method used from
| |
| serialize | back to summary |
|---|---|
| public void serialize(Duration duration, JsonGenerator generator, SerializationContext ctxt) throws JacksonException Implements abstract tools. Doc from tools. Method that can be called to ask implementation to serialize values of type this serializer handles.
| |
| withConverter | back to summary |
|---|---|
| protected DurationSerializer withConverter(DurationUnitConverter converter) | |
| withFeatures | back to summary |
|---|---|
| protected JSR310FormattedSerializerBase Overrides tools.
| |
| withFormat | back to summary |
|---|---|
| protected DurationSerializer withFormat(DateTimeFormatter dtf, Boolean useTimestamp, JsonFormat. Implements abstract tools.
| |