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)
res - the responseNullPointerException - if not validIllegalArgumentException - if not validpublic static <T> JsonRpcResponse<T> parseOne(com.fasterxml.jackson.databind.JsonNode content, Class<T> resultClass) throws IOException
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 occursNullPointerException - if response is null or emptyIllegalArgumentException - if response is not validpublic static <T> JsonRpcResponse<T> parseOne(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 occursNullPointerException - if response is null or emptyIllegalArgumentException - if response is not validpublic 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 occursNullPointerException - if response is null or emptyIllegalArgumentException - if response is not validpublic 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 occursNullPointerException - if response is null or emptyIllegalArgumentException - if response is not validCopyright © 2016. All rights reserved.