public class JsonSourceReader<T> extends java.lang.Object implements SourceReader<java.io.Reader,T>
| Constructor and Description |
|---|
JsonSourceReader(java.lang.Class<T> valueType)
Creates a new instance to read the JSON representation of an object.
|
JsonSourceReader(com.google.gson.reflect.TypeToken<T> valueType)
Creates a new instance to read the JSON representation of an object.
|
| Modifier and Type | Method and Description |
|---|---|
T |
read(java.io.Reader source)
Reads a
T-value from the data source. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waituncheckedReadpublic JsonSourceReader(java.lang.Class<T> valueType)
other
constructor instead.valueType - the class of the object to read.java.lang.NullPointerException - if any argument is null.public JsonSourceReader(com.google.gson.reflect.TypeToken<T> valueType)
other constructor instead.valueType - the generic class of the object to read, e.g.
new TypeToken<Optional<Integer>>(){}.java.lang.NullPointerException - if any argument is null.public T read(java.io.Reader source) throws com.google.gson.JsonSyntaxException, com.google.gson.JsonIOException
SourceReaderT-value from the data source.read in interface SourceReader<java.io.Reader,T>source - the data source.com.google.gson.JsonSyntaxExceptioncom.google.gson.JsonIOException