Class GsonFactoryBase<T extends Connection>

java.lang.Object
com.amilesend.client.parse.GsonFactoryBase<T>
Type Parameters:
T - The connection type that this factory is for

public abstract class GsonFactoryBase<T extends Connection> extends Object
Factory that vends new pre-configured Gson instances.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clear(T connection)
    Clears cached instances for the given connection.
    void
    Clears all cached instances.
    com.google.gson.Gson
    getInstance(T connection)
    Creates the configured Gson instance.
    com.google.gson.Gson
    Gets the configured Gson instance that provides pretty-printed formatted JSON (i.e., useful for testing and/or debugging).

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GsonFactoryBase

      public GsonFactoryBase()
  • Method Details

    • getInstance

      public com.google.gson.Gson getInstance(@NonNull T connection)
      Creates the configured Gson instance.
      Parameters:
      connection - the connection
      Returns:
      the Gson instance
    • getInstanceForPrettyPrinting

      public com.google.gson.Gson getInstanceForPrettyPrinting(@NonNull T connection)
      Gets the configured Gson instance that provides pretty-printed formatted JSON (i.e., useful for testing and/or debugging).
      Parameters:
      connection - the connection
      Returns:
      the pre-configured Gson instance
    • clearAll

      public void clearAll()
      Clears all cached instances.
    • clear

      public void clear(@NonNull T connection)
      Clears cached instances for the given connection.
      Parameters:
      connection - the connection