Class MapParser<K,V>

java.lang.Object
com.amilesend.client.parse.parser.MapParser<K,V>
Type Parameters:
K - the key object type
V - the value object type
All Implemented Interfaces:
GsonParser<Map<K,V>>

public class MapParser<K,V> extends Object implements GsonParser<Map<K,V>>
Defines a GsonParser implementation for a map of key value pairs.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapParser(@NonNull Class<K> keyClazz, @NonNull Class<V> valueClazz)
    Creates a new ListParser for the given class type.
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(@NonNull com.google.gson.Gson gson, @NonNull InputStream jsonStream)
    Deserializes a JSON-formatted input stream to the defined POJO type.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.amilesend.client.parse.parser.GsonParser

    parse
  • Constructor Details

    • MapParser

      public MapParser(@NonNull @NonNull Class<K> keyClazz, @NonNull @NonNull Class<V> valueClazz)
      Creates a new ListParser for the given class type.
      Parameters:
      keyClazz - the class type for the key
      valueClazz - the class type for the value
  • Method Details

    • parse

      public Map<K,V> parse(@NonNull @NonNull com.google.gson.Gson gson, @NonNull @NonNull InputStream jsonStream)
      Description copied from interface: GsonParser
      Deserializes a JSON-formatted input stream to the defined POJO type.
      Specified by:
      parse in interface GsonParser<K>
      Parameters:
      gson - the Gson instance used to deserialize the string
      jsonStream - stream with expected JSON-formatted contents
      Returns:
      the parsed POJO instance