Top Description Fields Constructors Methods
tools.jackson.databind.ext.javatime.ser

pack-priv abstract Class JSR310FormattedSerializerBase<T>

extends JSR310SerializerBase<T>
Class Inheritance
Known Direct Subclasses
tools.jackson.databind.ext.javatime.ser.LocalDateSerializer, tools.jackson.databind.ext.javatime.ser.LocalDateTimeSerializer, tools.jackson.databind.ext.javatime.ser.LocalTimeSerializer, tools.jackson.databind.ext.javatime.ser.MonthDaySerializer, tools.jackson.databind.ext.javatime.ser.MonthSerializer, tools.jackson.databind.ext.javatime.ser.OffsetTimeSerializer, tools.jackson.databind.ext.javatime.ser.YearMonthSerializer, tools.jackson.databind.ext.javatime.ser.YearSerializer, tools.jackson.databind.ext.javatime.ser.DurationSerializer, tools.jackson.databind.ext.javatime.ser.InstantSerializerBase
Imports
java.time.format.DateTimeFormatter, java.util.List, .Locale, com.fasterxml.jackson.annotation.JsonFormat, .JsonFormat.Shape, tools.jackson.databind.*, tools.jackson.databind.cfg.DateTimeFeature, tools.jackson.databind.jsonFormatVisitors.*

Base class that provides an array schema instead of scalar schema if SerializationFeature#WRITE_DATES_AS_TIMESTAMPS is enabled.
Author
Nick Williams

Field Summary

Modifier and TypeField and Description
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.

protected transient volatile JavaType
_integerListType

Lazily constructed JavaType representing type List<Integer>.

protected final JsonFormat.Shape
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.

protected final Boolean
_useTimestamp

Flag that indicates that serialization must be done as the Java timestamp, regardless of other settings.

Constructor Summary

AccessConstructor and Description
protected
protected
protected

Method Summary

Modifier and TypeMethod and Description
protected void
protected JavaType
protected DateTimeFormatter
protected boolean
public void
public ValueSerializer<?>
createContextual(SerializationContext ctxt, BeanProperty property)

Overrides tools.jackson.databind.ValueSerializer.createContextual.

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()

Overridable method that determines SerializationFeature that is used as the global default in determining if date/time value serialized should use numeric format ("timestamp") or not.

protected boolean
protected boolean
protected boolean
protected JSR310FormattedSerializerBase<?>
withFeatures(Boolean writeZoneId, Boolean writeNanoseconds)

protected abstract JSR310FormattedSerializerBase<?>
Inherited from tools.jackson.databind.ext.javatime.ser.JSR310SerializerBase:
serializationShapeserializeWithType

Field Detail

_formatterback to summary
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.

_integerListTypeback to summary
protected transient volatile JavaType _integerListType

Lazily constructed JavaType representing type List<Integer>.

Since
2.10
_shapeback to summary
protected final JsonFormat.Shape _shape
_useNanosecondsback to summary
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.

_useTimestampback to summary
protected final Boolean _useTimestamp

Flag that indicates that serialization must be done as the Java timestamp, regardless of other settings.

Constructor Detail

JSR310FormattedSerializerBaseback to summary
protected JSR310FormattedSerializerBase(Class<T> supportedType)
JSR310FormattedSerializerBaseback to summary
protected JSR310FormattedSerializerBase(Class<T> supportedType, DateTimeFormatter formatter)
JSR310FormattedSerializerBaseback to summary
protected JSR310FormattedSerializerBase(JSR310FormattedSerializerBase<?> base, DateTimeFormatter dtf, Boolean useTimestamp, Boolean useNanoseconds, JsonFormat.Shape shape)

Method Detail

_acceptTimestampVisitorback to summary
protected void _acceptTimestampVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
_integerListTypeback to summary
protected JavaType _integerListType(SerializationContext ctxt)
_useDateTimeFormatterback to summary
protected DateTimeFormatter _useDateTimeFormatter(SerializationContext ctxt, JsonFormat.Value format)
_useTimestampExplicitOnlyback to summary
protected boolean _useTimestampExplicitOnly(SerializationContext ctxt)
acceptJsonFormatVisitorback to summary
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)

Overrides tools.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Implements tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Doc from tools.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Default implementation specifies no format. This behavior is usually overriden by custom serializers.

Annotations
@Override
createContextualback to summary
public ValueSerializer<?> createContextual(SerializationContext ctxt, BeanProperty property)

Overrides tools.jackson.databind.ValueSerializer.createContextual.

Doc from tools.jackson.databind.ValueSerializer.createContextual.

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.

Annotations
@Override
getTimestampsFeatureback to summary
protected DateTimeFeature getTimestampsFeature()

Overridable method that determines SerializationFeature that is used as the global default in determining if date/time value serialized should use numeric format ("timestamp") or not.

Note that this feature is just the baseline setting and may be overridden on per-type or per-property basis.

Since
2.10
useNanosecondsback to summary
protected boolean useNanoseconds(SerializationContext ctxt)
useTimestampback to summary
protected boolean useTimestamp(SerializationContext ctxt)
useTimestampFromGlobalDefaultsback to summary
protected boolean useTimestampFromGlobalDefaults(SerializationContext ctxt)
withFeaturesback to summary
protected JSR310FormattedSerializerBase<?> withFeatures(Boolean writeZoneId, Boolean writeNanoseconds)
withFormatback to summary
protected abstract JSR310FormattedSerializerBase<?> withFormat(DateTimeFormatter dtf, Boolean useTimestamp, JsonFormat.Shape shape)