Class PositionDeserializer

java.lang.Object
org.rspeer.game.web.util.PositionDeserializer
All Implemented Interfaces:
com.google.gson.JsonDeserializer<Position>

public class PositionDeserializer extends Object implements com.google.gson.JsonDeserializer<Position>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    deserialize(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.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 passing json since that will cause an infinite loop (Gson will call your call-back method again).

      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<Position>
      Parameters:
      jsonElement - The Json data being deserialized
      type - 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 of typeofT