Package org.rspeer.game.web.util
Class PositionDeserializer
java.lang.Object
org.rspeer.game.web.util.PositionDeserializer
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<Position>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(com.google.gson.JsonElement jsonElement, Type type, com.google.gson.JsonDeserializationContext jsonDeserializationContext) Gson invokes this call-back method during deserialization when it encounters a field of the specified type.
-
Constructor Details
-
PositionDeserializer
public PositionDeserializer()
-
-
Method Details
-
deserialize
public Position deserialize(com.google.gson.JsonElement jsonElement, Type type, com.google.gson.JsonDeserializationContext jsonDeserializationContext) throws com.google.gson.JsonParseException Description copied from interface:com.google.gson.JsonDeserializer
Gson invokes this call-back method during deserialization when it encounters a field of the specified type.In the implementation of this call-back method, you should consider invoking
JsonDeserializationContext.deserialize(JsonElement, Type)
method to create objects for any non-trivial field of the returned object. However, you should never invoke it on the the same type passingjson
since that will cause an infinite loop (Gson will call your call-back method again).- Specified by:
deserialize
in interfacecom.google.gson.JsonDeserializer<Position>
- Parameters:
jsonElement
- The Json data being deserializedtype
- The type of the Object to deserialize to- Returns:
- a deserialized object of the specified type typeOfT which is a subclass of
T
- Throws:
com.google.gson.JsonParseException
- if json is not in the expected format oftypeofT
-