Package com.cheetahdigital.corekit.rest
Class BaseJson.IntegerTypeAdapter
- java.lang.Object
-
- com.google.gson.TypeAdapter<java.lang.Integer>
-
- com.cheetahdigital.corekit.rest.BaseJson.IntegerTypeAdapter
-
- Enclosing class:
- BaseJson
public abstract static class BaseJson.IntegerTypeAdapter extends com.google.gson.TypeAdapter<java.lang.Integer>CustomTypeAdapterfor integer types. TransformsStringinteger values to their appropriate integer values. Also handles "null" values from the server by providing a default value viagetDefaultValue().
-
-
Constructor Summary
Constructors Constructor Description IntegerTypeAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract intgetDefaultValue()Specify the default value on the occasion that the current value is null.java.lang.Integerread(com.google.gson.stream.JsonReader in)voidwrite(com.google.gson.stream.JsonWriter out, java.lang.Integer value)
-
-
-
Method Detail
-
write
public void write(com.google.gson.stream.JsonWriter out, java.lang.Integer value) throws java.io.IOException- Specified by:
writein classcom.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:
readin classcom.google.gson.TypeAdapter<java.lang.Integer>- Throws:
java.io.IOException
-
-