Package com.ibm.cloud.sdk.core.util
Class DynamicModelTypeAdapterFactory.Adapter<T>
- java.lang.Object
-
- com.google.gson.TypeAdapter<T>
-
- com.ibm.cloud.sdk.core.util.DynamicModelTypeAdapterFactory.Adapter<T>
-
- Enclosing class:
- DynamicModelTypeAdapterFactory
public static class DynamicModelTypeAdapterFactory.Adapter<T> extends com.google.gson.TypeAdapter<T>
An adapter for serializing/deserializing instances of type T, where T represents a generated dynamic model class which is a subclass of DynamicModel. Subclasses of DynamicModel will have zero or more explicitly-defined fields plus a map to store additional (arbitrary) properties.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gson.reflect.TypeToken<?>
getMapValueType(T instance)
Returns a TypeToken which represents the type of values stored in the DynamicModel's inherited map.T
read(com.google.gson.stream.JsonReader in)
void
write(com.google.gson.stream.JsonWriter out, T value)
-
-
-
Method Detail
-
write
public void write(com.google.gson.stream.JsonWriter out, T value) throws java.io.IOException
- Specified by:
write
in classcom.google.gson.TypeAdapter<T>
- Throws:
java.io.IOException
-
read
public T read(com.google.gson.stream.JsonReader in) throws java.io.IOException
- Specified by:
read
in classcom.google.gson.TypeAdapter<T>
- Throws:
java.io.IOException
-
getMapValueType
public com.google.gson.reflect.TypeToken<?> getMapValueType(T instance)
Returns a TypeToken which represents the type of values stored in the DynamicModel's inherited map.- Parameters:
instance
- the DynamicModel instance from which we'll retrieve the TypeToken- Returns:
- the TypeToken representing the map value type
-
-