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 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 the String into a LocalDate.
      Specified by:
      deserialize in interface com.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.