T
- The type this adapter should parse.public abstract class AbstractCalendarAdapter<T>
extends com.google.gson.TypeAdapter<T>
Calendar
object as a Gson
TypeAdapter
.
This may be used to specify an adapter 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 |
Constructor and Description |
---|
AbstractCalendarAdapter() |
Modifier and Type | Method and Description |
---|---|
protected abstract AbstractTypeConverter<T,Calendar> |
getConverterInstance()
Getter for an instance of the common conversion logic from and to
Calendar . |
protected abstract org.apache.olingo.odata2.core.edm.AbstractSimpleType |
getODataTypeInstance()
An instance of the EDM type to be used to parse between String and Calendar.
|
T |
read(com.google.gson.stream.JsonReader in) |
void |
write(com.google.gson.stream.JsonWriter out,
T value) |
@Nonnull protected abstract AbstractTypeConverter<T,Calendar> getConverterInstance()
Calendar
.@Nonnull protected abstract org.apache.olingo.odata2.core.edm.AbstractSimpleType getODataTypeInstance()
public void write(@Nonnull com.google.gson.stream.JsonWriter out, @Nullable T value) throws IOException
write
in class com.google.gson.TypeAdapter<T>
IOException
@Nullable public T read(@Nonnull com.google.gson.stream.JsonReader in) throws IOException
read
in class com.google.gson.TypeAdapter<T>
IOException
Copyright © 2018 SAP SE. All rights reserved.