Class LocalDateAdapter
java.lang.Object
net.thauvin.erik.frankfurter.models.LocalDateAdapter
- All Implemented Interfaces:
JsonDeserializer<LocalDate>
,JsonSerializer<LocalDate>
public class LocalDateAdapter
extends Object
implements JsonSerializer<LocalDate>, JsonDeserializer<LocalDate>
A custom adapter for serializing and deserializing
LocalDate
objects using Gson.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) serialize
(LocalDate localDate, Type type, JsonSerializationContext jsonSerializationContext)
-
Constructor Details
-
LocalDateAdapter
public LocalDateAdapter()
-
-
Method Details
-
deserialize
public LocalDate deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException - Specified by:
deserialize
in interfaceJsonDeserializer<LocalDate>
- Throws:
JsonParseException
-
serialize
public JsonElement serialize(LocalDate localDate, Type type, JsonSerializationContext jsonSerializationContext) - Specified by:
serialize
in interfaceJsonSerializer<LocalDate>
-