Class GsonDateTypeAdapter


  • public class GsonDateTypeAdapter
    extends com.google.gson.TypeAdapter<Date>
    Adapter for serializing and deserializing Date objects with GSON. This code is copied from DateTypeAdapter and modified slightly to add the Java9+ data time format when running in Java8 or earlier.
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • GsonDateTypeAdapter

        public GsonDateTypeAdapter()
      • GsonDateTypeAdapter

        @Deprecated
        public GsonDateTypeAdapter​(com.google.gson.Gson gson)
        Deprecated.
        Parameters:
        gson - Ignored.
    • Method Detail

      • write

        public void write​(com.google.gson.stream.JsonWriter out,
                          Date value)
                   throws IOException
        Specified by:
        write in class com.google.gson.TypeAdapter<Date>
        Throws:
        IOException
      • read

        public Date read​(com.google.gson.stream.JsonReader in)
                  throws IOException
        Specified by:
        read in class com.google.gson.TypeAdapter<Date>
        Throws:
        IOException