Interface GsonParser<T>
- Type Parameters:
T- the POJO type
- All Known Implementing Classes:
BasicParser, ListParser, MapParser
public interface GsonParser<T>
Defines a parser that deserializes a JSON-formatted source input stream to the defined POJO type.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Tparse(@NonNull com.google.gson.Gson gson, byte @NonNull [] jsonContent) Deserializes a JSON-formatted byte array to the defined POJO type.parse(com.google.gson.Gson gson, InputStream jsonStream) Deserializes a JSON-formatted input stream to the defined POJO type.
-
Method Details
-
parse
Deserializes a JSON-formatted input stream to the defined POJO type.- Parameters:
gson- the Gson instance used to deserialize the stringjsonStream- stream with expected JSON-formatted contents- Returns:
- the parsed POJO instance
-
parse
default T parse(@NonNull com.google.gson.Gson gson, byte @NonNull [] jsonContent) throws IOException Deserializes a JSON-formatted byte array to the defined POJO type.- Parameters:
gson- the Gson instance used to deserialize the stringjsonContent- the byte array- Returns:
- the parsed POJO instance
- Throws:
IOException
-