public class DefaultBoxJSONResponseParser extends java.lang.Object implements IBoxResponseParser
Constructor and Description |
---|
DefaultBoxJSONResponseParser(java.lang.Class objectClass,
IBoxJSONParser parser)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class |
getObjectClass()
Class of the wrapped object.
|
IBoxJSONParser |
getParser() |
java.lang.Object |
parse(IBoxResponse response)
By default, this only parses the JSON part into object.
|
protected java.lang.Object |
parseInputStream(java.io.InputStream in)
Parse input stream.
|
public DefaultBoxJSONResponseParser(java.lang.Class objectClass, IBoxJSONParser parser)
objectClass
- class of the wrapped object. Response from API will be parsed into this object, caller needs to make sure this class has fields with same
names as the JSON part of API response. If class contains more fields than the JSON, those fields will be left null. If the class contains
less fields than the JSON, the parsing will error out.parser
- IBoxJSONParserpublic IBoxJSONParser getParser()
public java.lang.Class getObjectClass()
public java.lang.Object parse(IBoxResponse response) throws BoxRestException
parse
in interface IBoxResponseParser
response
- API response.BoxRestException
protected java.lang.Object parseInputStream(java.io.InputStream in) throws BoxRestException, BoxJSONException, java.io.IOException
in
- input stream.BoxRestException
java.io.IOException
BoxJSONException