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>
CustomTypeAdapter
for integer types. TransformsString
integer 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 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)
-
-
-
Method Detail
-
write
public void write(com.google.gson.stream.JsonWriter out, java.lang.Integer value) throws java.io.IOException
- Specified by:
write
in 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:
read
in classcom.google.gson.TypeAdapter<java.lang.Integer>
- Throws:
java.io.IOException
-
-