Class LocalDateDeserializer
java.lang.Object
com.markvarga21.studentmanager.util.LocalDateDeserializer
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<LocalDate>
@Component
public class LocalDateDeserializer
extends Object
implements com.google.gson.JsonDeserializer<LocalDate>
A custom mapper for mapping the
String
representation
of a LocalDate
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) Deserializes theString
into aLocalDate
.
-
Constructor Details
-
LocalDateDeserializer
public LocalDateDeserializer()
-
-
Method Details
-
deserialize
public LocalDate deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException Deserializes theString
into aLocalDate
.- Specified by:
deserialize
in interfacecom.google.gson.JsonDeserializer<LocalDate>
- Parameters:
json
- The JSON content.typeOfT
- The type.context
- The context.- Returns:
- The deserialized
LocalDate
. - Throws:
com.google.gson.JsonParseException
- When the format is invalid.
-