Class BaseJson.ListStringTypeDeserializer

  • All Implemented Interfaces:
    com.google.gson.JsonDeserializer<java.util.List<java.lang.String>>
    Enclosing class:
    BaseJson

    public static class BaseJson.ListStringTypeDeserializer
    extends java.lang.Object
    implements com.google.gson.JsonDeserializer<java.util.List<java.lang.String>>
    Custom Deserializer for the Type List of Strings. There may be times that we expect a List<String> data type, but the value returned by the server is a single String value(e.g. "selected" : "item"). We handle it by just adding it to the List<String>, instead of interpreting as a single String value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> 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

      • ListStringTypeDeserializer

        public ListStringTypeDeserializer()
    • Method Detail

      • deserialize

        public java.util.List<java.lang.String> deserialize​(com.google.gson.JsonElement json,
                                                            java.lang.reflect.Type typeOfT,
                                                            com.google.gson.JsonDeserializationContext context)
                                                     throws com.google.gson.JsonParseException
        Specified by:
        deserialize in interface com.google.gson.JsonDeserializer<java.util.List<java.lang.String>>
        Throws:
        com.google.gson.JsonParseException