Class AdapterKamiX<T>
java.lang.Object
com.kamikazejam.kamicommon.util.adapter.AdapterKamiX<T>
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<T>,com.google.gson.JsonSerializer<T>
- Direct Known Subclasses:
AdapterKamiList,AdapterKamiMap,AdapterKamiSet,AdapterKamiTreeSet
public abstract class AdapterKamiX<T>
extends Object
implements com.google.gson.JsonDeserializer<T>, com.google.gson.JsonSerializer<T>
This is the abstract adapter for all "KamiCommon structures".
It makes sure Def instances "handle empty as null".
It makes sure we avoid infinite GSON recurse loops by recursing with supertype.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Tcreate(Object parent, com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) deserialize(com.google.gson.JsonElement json, Type type, com.google.gson.JsonDeserializationContext context) static Class<?> getClazz(@NotNull ParameterizedType pType) static @NotNull ObjectgetNewArgumentInstance(@NotNull Type type, int index) static @NotNull ParameterizedTypegetSuperType(@NotNull ParameterizedType pType) static booleancom.google.gson.JsonElement
-
Constructor Details
-
AdapterKamiX
public AdapterKamiX()
-
-
Method Details
-
serialize
public com.google.gson.JsonElement serialize(T src, Type type, com.google.gson.JsonSerializationContext context) - Specified by:
serializein interfacecom.google.gson.JsonSerializer<T>
-
deserialize
public T deserialize(com.google.gson.JsonElement json, Type type, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException - Specified by:
deserializein interfacecom.google.gson.JsonDeserializer<T>- Throws:
com.google.gson.JsonParseException
-
create
-
getClazz
-
getSuperType
@NotNull public static @NotNull ParameterizedType getSuperType(@NotNull @NotNull ParameterizedType pType) -
getNewArgumentInstance
-
isEmpty
-