Class ZonedDateTimeSerializer
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<T>
com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
com.fasterxml.jackson.datatype.jsr310.ser.InstantSerializerBase<ZonedDateTime>
com.fasterxml.jackson.datatype.jsr310.ser.ZonedDateTimeSerializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
,com.fasterxml.jackson.databind.jsonschema.SchemaAware
,com.fasterxml.jackson.databind.ser.ContextualSerializer
,Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DateTimeFormatter
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 com.fasterxml.jackson.databind.JavaType
Lazily constructedJavaType
representing typeList<Integer>
.protected final com.fasterxml.jackson.annotation.JsonFormat.Shape
protected final Boolean
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
Flag that indicates that serialization must be done as the Java timestamp, regardless of other settings.protected final Boolean
Flag forJsonFormat.Feature.WRITE_DATES_WITH_ZONE_ID
static final ZonedDateTimeSerializer
Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_handledType
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
protected
ZonedDateTimeSerializer
(ZonedDateTimeSerializer base, Boolean useTimestamp, Boolean useNanoseconds, DateTimeFormatter formatter, com.fasterxml.jackson.annotation.JsonFormat.Shape shape, Boolean writeZoneId) protected
ZonedDateTimeSerializer
(ZonedDateTimeSerializer base, Boolean useTimestamp, Boolean useNanoseconds, DateTimeFormatter formatter, Boolean writeZoneId) Deprecated.protected
ZonedDateTimeSerializer
(ZonedDateTimeSerializer base, Boolean useTimestamp, DateTimeFormatter formatter, Boolean writeZoneId) ZonedDateTimeSerializer
(DateTimeFormatter formatter) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.fasterxml.jackson.databind.JavaType
_integerListType
(com.fasterxml.jackson.databind.SerializerProvider prov) protected DateTimeFormatter
_useDateTimeFormatter
(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.annotation.JsonFormat.Value format) protected boolean
_useTimestampExplicitOnly
(com.fasterxml.jackson.databind.SerializerProvider provider) void
acceptJsonFormatVisitor
(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper visitor, com.fasterxml.jackson.databind.JavaType typeHint) com.fasterxml.jackson.databind.JsonSerializer<?>
createContextual
(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.databind.BeanProperty property) com.fasterxml.jackson.databind.JsonNode
protected com.fasterxml.jackson.databind.SerializationFeature
Overridable method that determinesSerializationFeature
that is used as the global default in determining if date/time value serialized should use numeric format ("timestamp") or not.protected com.fasterxml.jackson.core.JsonToken
serializationShape
(com.fasterxml.jackson.databind.SerializerProvider provider) Overridable helper method used fromJsonSerializer.serializeWithType(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)
, to indicate shape of value during serialization; needed to know how type id is to be serialized.void
serialize
(ZonedDateTime value, com.fasterxml.jackson.core.JsonGenerator g, com.fasterxml.jackson.databind.SerializerProvider provider) void
serializeWithType
(ZonedDateTime value, com.fasterxml.jackson.core.JsonGenerator g, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer) boolean
shouldWriteWithZoneId
(com.fasterxml.jackson.databind.SerializerProvider ctxt) protected boolean
useNanoseconds
(com.fasterxml.jackson.databind.SerializerProvider provider) protected boolean
useTimestamp
(com.fasterxml.jackson.databind.SerializerProvider provider) protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?>
withFeatures
(Boolean writeZoneId) Deprecated.protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?>
withFeatures
(Boolean writeZoneId, Boolean writeNanoseconds) protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?>
withFormat
(Boolean useTimestamp, DateTimeFormatter formatter, com.fasterxml.jackson.annotation.JsonFormat.Shape shape) Methods inherited from class com.fasterxml.jackson.datatype.jsr310.ser.InstantSerializerBase
_acceptTimestampVisitor, formatValue
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
-
Field Details
-
INSTANCE
-
_writeZoneId
Flag forJsonFormat.Feature.WRITE_DATES_WITH_ZONE_ID
- Since:
- 2.8
-
_useTimestamp
Flag that indicates that serialization must be done as the Java timestamp, regardless of other settings. -
_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
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 com.fasterxml.jackson.annotation.JsonFormat.Shape _shape -
_integerListType
protected transient volatile com.fasterxml.jackson.databind.JavaType _integerListTypeLazily constructedJavaType
representing typeList<Integer>
.- Since:
- 2.10
-
-
Constructor Details
-
ZonedDateTimeSerializer
protected ZonedDateTimeSerializer() -
ZonedDateTimeSerializer
-
ZonedDateTimeSerializer
protected ZonedDateTimeSerializer(ZonedDateTimeSerializer base, Boolean useTimestamp, DateTimeFormatter formatter, Boolean writeZoneId) -
ZonedDateTimeSerializer
@Deprecated protected ZonedDateTimeSerializer(ZonedDateTimeSerializer base, Boolean useTimestamp, Boolean useNanoseconds, DateTimeFormatter formatter, Boolean writeZoneId) Deprecated. -
ZonedDateTimeSerializer
protected ZonedDateTimeSerializer(ZonedDateTimeSerializer base, Boolean useTimestamp, Boolean useNanoseconds, DateTimeFormatter formatter, com.fasterxml.jackson.annotation.JsonFormat.Shape shape, Boolean writeZoneId) - Since:
- 2.14
-
-
Method Details
-
withFormat
protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?> withFormat(Boolean useTimestamp, DateTimeFormatter formatter, com.fasterxml.jackson.annotation.JsonFormat.Shape shape) - Specified by:
withFormat
in classInstantSerializerBase<ZonedDateTime>
-
withFeatures
@Deprecated protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?> withFeatures(Boolean writeZoneId) Deprecated. -
withFeatures
-
serialize
public void serialize(ZonedDateTime value, com.fasterxml.jackson.core.JsonGenerator g, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException - Overrides:
serialize
in classInstantSerializerBase<ZonedDateTime>
- Throws:
IOException
-
shouldWriteWithZoneId
public boolean shouldWriteWithZoneId(com.fasterxml.jackson.databind.SerializerProvider ctxt) - Since:
- 2.8
-
serializationShape
protected com.fasterxml.jackson.core.JsonToken serializationShape(com.fasterxml.jackson.databind.SerializerProvider provider) Overridable helper method used fromJsonSerializer.serializeWithType(T, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer)
, to indicate shape of value during serialization; needed to know how type id is to be serialized.- Overrides:
serializationShape
in classInstantSerializerBase<ZonedDateTime>
-
createContextual
public com.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.databind.BeanProperty property) throws com.fasterxml.jackson.databind.JsonMappingException - Specified by:
createContextual
in interfacecom.fasterxml.jackson.databind.ser.ContextualSerializer
- Throws:
com.fasterxml.jackson.databind.JsonMappingException
-
getSchema
public com.fasterxml.jackson.databind.JsonNode getSchema(com.fasterxml.jackson.databind.SerializerProvider provider, Type typeHint) - Specified by:
getSchema
in interfacecom.fasterxml.jackson.databind.jsonschema.SchemaAware
- Overrides:
getSchema
in classcom.fasterxml.jackson.databind.ser.std.StdSerializer<T>
-
acceptJsonFormatVisitor
public void acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper visitor, com.fasterxml.jackson.databind.JavaType typeHint) throws com.fasterxml.jackson.databind.JsonMappingException - Specified by:
acceptJsonFormatVisitor
in interfacecom.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
- Overrides:
acceptJsonFormatVisitor
in classcom.fasterxml.jackson.databind.ser.std.StdSerializer<T>
- Throws:
com.fasterxml.jackson.databind.JsonMappingException
-
_integerListType
protected com.fasterxml.jackson.databind.JavaType _integerListType(com.fasterxml.jackson.databind.SerializerProvider prov) -
getTimestampsFeature
protected com.fasterxml.jackson.databind.SerializationFeature getTimestampsFeature()Overridable method that determinesSerializationFeature
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
-
useTimestamp
protected boolean useTimestamp(com.fasterxml.jackson.databind.SerializerProvider provider) -
_useTimestampExplicitOnly
protected boolean _useTimestampExplicitOnly(com.fasterxml.jackson.databind.SerializerProvider provider) -
useNanoseconds
protected boolean useNanoseconds(com.fasterxml.jackson.databind.SerializerProvider provider) -
_useDateTimeFormatter
protected DateTimeFormatter _useDateTimeFormatter(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.annotation.JsonFormat.Value format) -
serializeWithType
public void serializeWithType(ZonedDateTime value, com.fasterxml.jackson.core.JsonGenerator g, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer) throws IOException - Overrides:
serializeWithType
in classcom.fasterxml.jackson.databind.JsonSerializer<T>
- Throws:
IOException
-