Class BaseCollectionDeserializer<E>

java.lang.Object
com.github.natche.gravatarjavaclient.profile.gson.BaseCollectionDeserializer<E>
Type Parameters:
E - the entity type
All Implemented Interfaces:
com.google.gson.JsonDeserializer<E>
Direct Known Subclasses:
ImmutableListDeserializer

public abstract class BaseCollectionDeserializer<E> extends Object implements com.google.gson.JsonDeserializer<E>
A collection deserializer for use by Gson to deserialize a collection token into an ImmutableList.
  • Constructor Details

    • BaseCollectionDeserializer

      public BaseCollectionDeserializer()
  • Method Details

    • buildFrom

      protected abstract E buildFrom(Collection<?> collection)
    • deserialize

      public E deserialize(com.google.gson.JsonElement json, Type type, com.google.gson.JsonDeserializationContext context)
      Deserializes the provided JSON element.
      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<E>
      Parameters:
      json - The Json data being deserialized
      type - The type of the Object to deserialize to
      context - tge deserialization context
      Returns:
      the deserialized object, collection in this case