Class MapTypeAdapterFactory.Adapter<K,​V>

    • Constructor Detail

      • Adapter

        public Adapter​(Gson context,
                       java.lang.reflect.Type keyType,
                       TypeAdapter<K> keyTypeAdapter,
                       java.lang.reflect.Type valueType,
                       TypeAdapter<V> valueTypeAdapter,
                       ObjectConstructor<? extends java.util.Map<K,​V>> constructor)
    • Method Detail

      • read

        public java.util.Map<K,​V> read​(JsonReader in)
                                      throws java.io.IOException
        Description copied from class: TypeAdapter
        Reads one JSON value (an array, object, string, number, boolean or null) and converts it to a Java object. Returns the converted object.
        Specified by:
        read in class TypeAdapter<java.util.Map<K,​V>>
        Returns:
        the converted Java object. May be null.
        Throws:
        java.io.IOException
      • write

        public void write​(JsonWriter out,
                          java.util.Map<K,​V> map)
                   throws java.io.IOException
        Description copied from class: TypeAdapter
        Writes one JSON value (an array, object, string, number, boolean or null) for value.
        Specified by:
        write in class TypeAdapter<java.util.Map<K,​V>>
        map - the Java object to write. May be null.
        Throws:
        java.io.IOException
      • keyToString

        private java.lang.String keyToString​(JsonElement keyElement)