public abstract class ResponseParser extends Object
| Constructor and Description |
|---|
ResponseParser() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertValid(com.fasterxml.jackson.databind.JsonNode res)
Assert JsonNode is valid JSON RPC 2.0 Response (either object or array).
|
static <T> List<JsonRpcResponse<T>> |
parseList(InputStream content,
Class<T> resultClass)
Parse InputStream to JsonRpcResponse List with resultClass.
|
static <T> List<JsonRpcResponse<T>> |
parseList(com.fasterxml.jackson.databind.JsonNode content,
Class<T> resultClass)
Parse JsonNode to JsonRpcResponse List with resultClass.
|
static <T> JsonRpcResponse<T> |
parseOne(InputStream content,
Class<T> resultClass)
Parse InputStream to JsonRpcResponse with resultClass.
|
static <T> JsonRpcResponse<T> |
parseOne(com.fasterxml.jackson.databind.JsonNode content,
Class<T> resultClass)
Parse JsonNode to JsonRpcResponse with resultClass.
|
public static void assertValid(com.fasterxml.jackson.databind.JsonNode res)
throws ParseException
res - the responseParseException - if response is null, empty, or invalidpublic static <T> JsonRpcResponse<T> parseOne(com.fasterxml.jackson.databind.JsonNode content, Class<T> resultClass) throws IOException, ParseException
T - the type inference for the resultcontent - the ObjectNode JSON treeresultClass - the result payload DTO class. Should be a Serializable POJOIOException - if response is parsing error occursParseException - if response is null, empty, or invalidpublic static <T> JsonRpcResponse<T> parseOne(InputStream content, Class<T> resultClass) throws IOException, ParseException
T - the type inference for the resultcontent - the InputStream contentresultClass - the result payload DTO class. Should be a Serializable POJOIOException - if response is parsing error occursParseException - if response is null, empty, or invalidpublic static <T> List<JsonRpcResponse<T>> parseList(com.fasterxml.jackson.databind.JsonNode content, Class<T> resultClass) throws IOException
T - the type inference for the resultcontent - the ArrayNode JSON TreeresultClass - the result payload DTO class. Should be a Serializable POJOIOException - if response is parsing error occurspublic static <T> List<JsonRpcResponse<T>> parseList(InputStream content, Class<T> resultClass) throws IOException
T - the type inference for the resultcontent - the InputStream contentresultClass - the result payload DTO class. Should be a Serializable POJOIOException - if response is parsing error occursCopyright © 2017. All rights reserved.