Class AbstractJacksonCalendarSerializer<T>
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<T>
com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
com.sap.cloud.sdk.s4hana.datamodel.odata.adapter.AbstractJacksonCalendarSerializer<T>
- Type Parameters:
T
- The type this serializer should read.
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
,com.fasterxml.jackson.databind.jsonschema.SchemaAware
,Serializable
- Direct Known Subclasses:
JacksonLocalDateTimeSerializer
,JacksonLocalTimeSerializer
,JacksonZonedDateTimeSerializer
public abstract class AbstractJacksonCalendarSerializer<T>
extends com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
Abstract base class to be used to easily write fields which can be read as a
Calendar
object as a Jackson
StdSerializer
.
This may be used to specify a deserializer for the new Java date API (e.g. LocalDateTime
) based on
a common conversion logic. This way the logic is split the following way:
General Conversion logic | AbstractTypeConverter subclasses (*CalendarConverter) |
Gson Adapter | AbstractCalendarAdapter subclasses |
Jackson (De)Serializer | AbstractJacksonCalendar(De)Serializer and subclasses |
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None
-
Field Summary
Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_handledType
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor needed by the super class. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract AbstractTypeConverter<T,
Calendar> Getter for an instance of the common conversion logic from and toCalendar
.protected abstract AbstractTypeConverter<String,
Calendar> Getter for the conversion of a Calendar object into a String.void
serialize
(T value, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, acceptJsonFormatVisitor, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, 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, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties
-
Constructor Details
-
AbstractJacksonCalendarSerializer
Constructor needed by the super class.- Parameters:
t
- The class to be written by this serializer.
-
-
Method Details
-
getConverterInstance
Getter for an instance of the common conversion logic from and toCalendar
.- Returns:
- The conversion logic for this serializer.
-
getStringCalendarConverterInstance
@Nonnull protected abstract AbstractTypeConverter<String,Calendar> getStringCalendarConverterInstance()Getter for the conversion of a Calendar object into a String. The selection of implementation depends on what kind of date object the string value should represent.- Returns:
AbstractTypeConverter
instance that converts a Calendar into a String.
-
serialize
public void serialize(@Nullable T value, @Nonnull com.fasterxml.jackson.core.JsonGenerator jsonGenerator, @Nonnull com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws IOException - Specified by:
serialize
in classcom.fasterxml.jackson.databind.ser.std.StdSerializer<T>
- Throws:
IOException
-