Class BasicParser<T>

java.lang.Object
com.amilesend.client.parse.parser.BasicParser<T>
Type Parameters:
T - the object type
All Implemented Interfaces:
GsonParser<T>

public class BasicParser<T> extends Object implements GsonParser<T>
Defines a basic GsonParser implementation for single object type.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BasicParser(@NonNull Class<T> clazz)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(@NonNull com.google.gson.Gson gson, @NonNull InputStream jsonStream)
    Deserializes a JSON-formatted input stream to the defined POJO type.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface GsonParser

    parse
    Modifier and Type
    Method
    Description
    default T
    parse(@NonNull com.google.gson.Gson gson, byte @NonNull [] jsonContent)
    Deserializes a JSON-formatted byte array to the defined POJO type.
  • Constructor Details

    • BasicParser

      public BasicParser(@NonNull Class<T> clazz)
  • Method Details

    • parse

      public T parse(@NonNull com.google.gson.Gson gson, @NonNull InputStream jsonStream)
      Description copied from interface: GsonParser
      Deserializes a JSON-formatted input stream to the defined POJO type.
      Specified by:
      parse in interface GsonParser<T>
      Parameters:
      gson - the Gson instance used to deserialize the string
      jsonStream - stream with expected JSON-formatted contents
      Returns:
      the parsed POJO instance