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

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor needed by the super class.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract AbstractTypeConverter<T,Calendar>
    Getter for an instance of the common conversion logic from and to 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractJacksonCalendarSerializer

      protected AbstractJacksonCalendarSerializer(Class<T> t)
      Constructor needed by the super class.
      Parameters:
      t - The class to be written by this serializer.
  • Method Details

    • getConverterInstance

      @Nonnull protected abstract AbstractTypeConverter<T,Calendar> getConverterInstance()
      Getter for an instance of the common conversion logic from and to Calendar.
      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 class com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
      Throws:
      IOException