Class VehicleResponseDeserializer

  • All Implemented Interfaces:
    com.google.gson.JsonDeserializer<VehicleResponse>

    public class VehicleResponseDeserializer
    extends java.lang.Object
    implements com.google.gson.JsonDeserializer<VehicleResponse>
    VehicleResponseDeserializer

    This is a customer deserialization method to be used by the GSON object. By default, if you pass a JSON object to GSON and tell it to turn that object into a class, it looks at the instance variables on that class, and it attempts to assign vars from the JSON to this class.

    But for the VehicleResponse class, we need to process that entire JSON response to the body field. This method allows us to send the JSON data through the VehicleResponse constructor.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      VehicleResponse deserialize​(com.google.gson.JsonElement json, java.lang.reflect.Type typeOfT, com.google.gson.JsonDeserializationContext context)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VehicleResponseDeserializer

        public VehicleResponseDeserializer()
    • Method Detail

      • deserialize

        public VehicleResponse deserialize​(com.google.gson.JsonElement json,
                                           java.lang.reflect.Type typeOfT,
                                           com.google.gson.JsonDeserializationContext context)
        Specified by:
        deserialize in interface com.google.gson.JsonDeserializer<VehicleResponse>