Class SqlDateSerializer
- All Implemented Interfaces:
tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
@JacksonComponent
public class SqlDateSerializer
extends tools.jackson.databind.ser.std.StdSerializer<Date>
Serializes a
Date as an ISO date without a time, for example "2026-10-21".
GeoTools returns the values of date database columns as Date, and the features API passes
them to Jackson unchanged. Jackson 2 serialized a java.sql.Date with toString() as a date only.
Jackson 3 serializes it like a Date, as a timestamp in UTC (for example
"2026-10-21T00:00:00.000Z"), which the viewer does not accept for date fields. When the JVM time zone is not
UTC that timestamp can even fall on the previous day. Jackson 3 has no feature to restore the old behaviour, so this
serializer does.
Date.toLocalDate() uses the JVM default time zone, the same time zone the JDBC driver used to create the
java.sql.Date, so the date is the date stored in the database.
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.ValueSerializer
tools.jackson.databind.ValueSerializer.None -
Field Summary
Fields inherited from class tools.jackson.databind.ser.std.StdSerializer
_handledType -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class tools.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, _wrapIOFailure, acceptJsonFormatVisitor, acceptJsonFormatVisitorForBinary, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowMethods inherited from class tools.jackson.databind.ValueSerializer
createContextual, getDelegatee, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, resolve, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withFormatOverrides, withIgnoredProperties
-
Constructor Details
-
SqlDateSerializer
public SqlDateSerializer()
-
-
Method Details
-
serialize
-