Class BaseJson.IntegerTypeAdapter

  • Enclosing class:
    BaseJson

    public abstract static class BaseJson.IntegerTypeAdapter
    extends com.google.gson.TypeAdapter<java.lang.Integer>
    Custom TypeAdapter for integer types. Transforms String integer values to their appropriate integer values. Also handles "null" values from the server by providing a default value via getDefaultValue().
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract int getDefaultValue()
      Specify the default value on the occasion that the current value is null.
      java.lang.Integer read​(com.google.gson.stream.JsonReader in)  
      void write​(com.google.gson.stream.JsonWriter out, java.lang.Integer value)  
      • Methods inherited from class com.google.gson.TypeAdapter

        fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntegerTypeAdapter

        public IntegerTypeAdapter()
    • Method Detail

      • write

        public void write​(com.google.gson.stream.JsonWriter out,
                          java.lang.Integer value)
                   throws java.io.IOException
        Specified by:
        write in class com.google.gson.TypeAdapter<java.lang.Integer>
        Throws:
        java.io.IOException
      • getDefaultValue

        public abstract int getDefaultValue()
        Specify the default value on the occasion that the current value is null.
        Returns:
        an int value.
      • read

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