Class CollectionTypeAdapter<E>

  • Direct Known Subclasses:
    CollectionTypeAdapterFactory.Adapter

    public class CollectionTypeAdapter<E>
    extends com.google.gson.TypeAdapter<java.util.Collection<E>>
    A specialized type adapter for collections that can handle single values.
    • Constructor Summary

      Constructors 
      Constructor Description
      CollectionTypeAdapter​(com.google.gson.Gson gson, java.lang.reflect.Type elementType, com.google.gson.TypeAdapter<E> elementTypeAdapter, java.util.function.Supplier<java.util.Collection<E>> constructor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<E> read​(com.google.gson.stream.JsonReader in)  
      void write​(com.google.gson.stream.JsonWriter out, java.util.Collection<E> collection)  
      • Methods inherited from class com.google.gson.TypeAdapter

        fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree
      • Methods inherited from class java.lang.Object

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

      • CollectionTypeAdapter

        public CollectionTypeAdapter​(com.google.gson.Gson gson,
                                     java.lang.reflect.Type elementType,
                                     com.google.gson.TypeAdapter<E> elementTypeAdapter,
                                     java.util.function.Supplier<java.util.Collection<E>> constructor)
    • Method Detail

      • read

        public java.util.Collection<E> read​(com.google.gson.stream.JsonReader in)
                                     throws java.io.IOException
        Specified by:
        read in class com.google.gson.TypeAdapter<java.util.Collection<E>>
        Throws:
        java.io.IOException
      • write

        public void write​(com.google.gson.stream.JsonWriter out,
                          java.util.Collection<E> collection)
                   throws java.io.IOException
        Specified by:
        write in class com.google.gson.TypeAdapter<java.util.Collection<E>>
        Throws:
        java.io.IOException