Package it.polimi.ingsw.Common
Class GsonInterfaceSerializer<T>
java.lang.Object
it.polimi.ingsw.Common.GsonInterfaceSerializer<T>
- Type Parameters:
T
- effective type
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<T>
,com.google.gson.JsonSerializer<T>
public final class GsonInterfaceSerializer<T>
extends Object
implements com.google.gson.JsonSerializer<T>, com.google.gson.JsonDeserializer<T>
Serializer for Gson Interfaces
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(com.google.gson.JsonElement jsonElement, Type typeOfT, com.google.gson.JsonDeserializationContext context) static <T> GsonInterfaceSerializer<T>
interfaceSerializer
(Class<T> implementationClass) Implementation of Gson Interface Serializercom.google.gson.JsonElement
-
Field Details
-
implementationClass
-
-
Constructor Details
-
GsonInterfaceSerializer
-
-
Method Details
-
interfaceSerializer
Implementation of Gson Interface Serializer- Type Parameters:
T
- object type- Parameters:
implementationClass
- effective type- Returns:
- serializer
-
serialize
public com.google.gson.JsonElement serialize(T value, Type type, com.google.gson.JsonSerializationContext context) - Specified by:
serialize
in interfacecom.google.gson.JsonSerializer<T>
-
deserialize
public T deserialize(com.google.gson.JsonElement jsonElement, Type typeOfT, com.google.gson.JsonDeserializationContext context) - Specified by:
deserialize
in interfacecom.google.gson.JsonDeserializer<T>
-