public class SimpleJacksonParser extends java.lang.Object implements Parser<ResourceRepresentation<?>>
Modifier and Type | Field and Description |
---|---|
static int |
DATA_OK |
protected java.lang.Class<?> |
mClazz |
com.fasterxml.jackson.databind.ObjectMapper |
mJSONMapper |
protected int |
mResultCode |
protected java.lang.String |
mSimpleClassName |
static int |
PARSER_KO |
static int |
PARSER_KO_JSON_MALFORMED |
static int |
PARSER_KO_JSON_OBJETS_INVALID |
Constructor and Description |
---|
SimpleJacksonParser(java.lang.Class<T> clazz) |
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
int |
getResultCode() |
<R extends ResourceRepresentation<?>> |
parseToInputStream(R resource)
Use this method to return InputStream parsed from
ResourceRepresentation |
ResourceRepresentation<?> |
parseToObject(java.io.InputStream content)
Use this method to return parsed
ResourceRepresentation from InputStream |
protected void |
setResultCode(int resultCode) |
public static final int DATA_OK
public static final int PARSER_KO
public static final int PARSER_KO_JSON_MALFORMED
public static final int PARSER_KO_JSON_OBJETS_INVALID
public com.fasterxml.jackson.databind.ObjectMapper mJSONMapper
protected int mResultCode
protected java.lang.String mSimpleClassName
protected java.lang.Class<?> mClazz
public ResourceRepresentation<?> parseToObject(java.io.InputStream content) throws ParsingException
Parser
ResourceRepresentation
from InputStreamparseToObject
in interface Parser<ResourceRepresentation<?>>
content
- The InputStream representing ResourceRepresentation
ResourceRepresentation
ParsingException
public <R extends ResourceRepresentation<?>> java.io.InputStream parseToInputStream(R resource) throws ParsingException
Parser
ResourceRepresentation
parseToInputStream
in interface Parser<ResourceRepresentation<?>>
resource
- The ResourceRepresentation
which will be parsed to InputStreamResourceRepresentation
ParsingException
protected void setResultCode(int resultCode)
public int getResultCode()
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()