Class CollectionAdapter

  • All Implemented Interfaces:
    com.google.gson.JsonSerializer<java.util.Collection<?>>

    @Internal
    public final class CollectionAdapter
    extends java.lang.Object
    implements com.google.gson.JsonSerializer<java.util.Collection<?>>
    Serializes collections to JSON. When collection is empty or null, returns null.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @Nullable com.google.gson.JsonElement serialize​(@Nullable java.util.Collection<?> src, @NotNull java.lang.reflect.Type typeOfSrc, @NotNull com.google.gson.JsonSerializationContext context)  
      • Methods inherited from class java.lang.Object

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

      • CollectionAdapter

        public CollectionAdapter()
    • Method Detail

      • serialize

        @Nullable
        public @Nullable com.google.gson.JsonElement serialize​(@Nullable
                                                               @Nullable java.util.Collection<?> src,
                                                               @NotNull
                                                               @NotNull java.lang.reflect.Type typeOfSrc,
                                                               @NotNull
                                                               @NotNull com.google.gson.JsonSerializationContext context)
        Specified by:
        serialize in interface com.google.gson.JsonSerializer<java.util.Collection<?>>