MotechJsonReader¶
-
public class
MotechJsonReader
¶ Class responsible for creating objects from json. It can use
InputStream
,String
or file classpath. This class uses Gson underneath.See also: Google Gson
Constructors¶
Methods¶
readFromFile¶
readFromStream¶
-
public Object
readFromStream
(InputStream stream, Type ofType)¶ Creates object of type
ofType
from input stream.Parameters: - stream – the stream to deserialize
- ofType – the type of created object
Returns: object of type
ofType
readFromStreamOnlyExposeAnnotations¶
-
public Object
readFromStreamOnlyExposeAnnotations
(InputStream stream, Type ofType)¶ Creates object of type
ofType
from input stream. Will only deserialize fields withExpose
annotation.Parameters: - stream – the stream to deserialize
- ofType – the type of created object
Returns: object of type
ofType
readFromString¶
readFromString¶
-
public Object
readFromString
(String text, Type ofType, Map<Type, Object> typeAdapters)¶ Creates object of type
ofType
from givenString
using user-specified adapters.Parameters: - text – the
String
to deserialize - ofType – the type of created object
- typeAdapters – custom adapters to use for deserialization
Returns: object of type
ofType
- text – the