Class GsonSingleton


  • public final class GsonSingleton
    extends java.lang.Object
    Gson singleton to be use when transforming from JSON to Java Objects and vise versa. It handles date formatting and pretty print the result
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static com.google.gson.TypeAdapter<java.lang.Number> LAZILY_PARSED_NUMBER_ADAPTER  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.google.gson.Gson getGson()
      Gets the Gson instance.
      static com.google.gson.Gson getGsonWithoutPrettyPrinting()
      Gets the Gson instance.
      static com.google.gson.Gson getGsonWithSerializeNulls()
      Returns an instance of Gson with the "serialize nulls" config option enabled.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LAZILY_PARSED_NUMBER_ADAPTER

        public static final com.google.gson.TypeAdapter<java.lang.Number> LAZILY_PARSED_NUMBER_ADAPTER
    • Method Detail

      • getGson

        public static com.google.gson.Gson getGson()
        Gets the Gson instance.
        Returns:
        the Gson
      • getGsonWithoutPrettyPrinting

        public static com.google.gson.Gson getGsonWithoutPrettyPrinting()
        Gets the Gson instance.
        Returns:
        the Gson
      • getGsonWithSerializeNulls

        public static com.google.gson.Gson getGsonWithSerializeNulls()
        Returns an instance of Gson with the "serialize nulls" config option enabled.
        Returns:
        a Gson instance configured to serialize nulls