public class HiveResponseBody
extends java.lang.Object
| Constructor and Description |
|---|
HiveResponseBody() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Exception |
convertException(java.lang.Exception e) |
boolean |
failed() |
protected java.lang.String |
getDateStrByStamp(long value) |
int |
getErrorCode() |
java.lang.String |
getErrorMessage() |
static java.util.Map<java.lang.Integer,java.lang.String> |
getHttpErrorMessages() |
static java.io.IOException |
getHttpExceptionByCode(int code,
java.lang.String message) |
static <T> T |
getRequestStream(java.net.HttpURLConnection connection,
java.lang.Class<T> resultType) |
static <T> T |
getResponseStream(retrofit2.Response<okhttp3.ResponseBody> response,
java.lang.Class<T> resultType) |
java.lang.String |
getStatus() |
static <T> T |
getValue(java.lang.String json,
java.lang.Class<T> clz) |
static KeyValueDict |
jsonNode2KeyValueDic(com.fasterxml.jackson.databind.JsonNode node) |
static java.util.Map<java.lang.String,java.lang.Object> |
jsonNode2Map(com.fasterxml.jackson.databind.JsonNode node) |
static java.util.List<KeyValueDict> |
jsonNodeList2KeyValueDicList(java.util.List<com.fasterxml.jackson.databind.JsonNode> docs) |
static com.fasterxml.jackson.databind.JsonNode |
KeyValueDict2JsonNode(KeyValueDict dict) |
static java.util.List<com.fasterxml.jackson.databind.JsonNode> |
KeyValueDictList2JsonNodeList(java.util.List<KeyValueDict> dicts) |
static com.fasterxml.jackson.databind.JsonNode |
map2JsonNode(java.util.Map<java.lang.String,java.lang.Object> map) |
void |
setStatus(java.lang.String status) |
static <T extends HiveResponseBody> |
validateBody(retrofit2.Response<T> response)
We can't check status on interceptor because of body string can be only read once.
|
static <T extends HiveResponseBody> |
validateBody(T body) |
static java.lang.String |
validateBodyStr(retrofit2.Response<okhttp3.ResponseBody> response) |
public void setStatus(java.lang.String status)
public java.lang.String getStatus()
public int getErrorCode()
public java.lang.String getErrorMessage()
public boolean failed()
public static <T extends HiveResponseBody> T validateBody(retrofit2.Response<T> response) throws java.io.IOException
T - response body typeresponse - responsejava.io.IOException - IOExceptionpublic static <T extends HiveResponseBody> T validateBody(T body) throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String validateBodyStr(retrofit2.Response<okhttp3.ResponseBody> response)
public static <T> T getValue(java.lang.String json,
java.lang.Class<T> clz)
public static <T> T getRequestStream(java.net.HttpURLConnection connection,
java.lang.Class<T> resultType)
throws java.io.IOException
java.io.IOExceptionpublic static <T> T getResponseStream(retrofit2.Response<okhttp3.ResponseBody> response,
java.lang.Class<T> resultType)
public static java.util.Map<java.lang.String,java.lang.Object> jsonNode2Map(com.fasterxml.jackson.databind.JsonNode node)
public static com.fasterxml.jackson.databind.JsonNode map2JsonNode(java.util.Map<java.lang.String,java.lang.Object> map)
public static KeyValueDict jsonNode2KeyValueDic(com.fasterxml.jackson.databind.JsonNode node)
public static java.util.List<KeyValueDict> jsonNodeList2KeyValueDicList(java.util.List<com.fasterxml.jackson.databind.JsonNode> docs)
public static com.fasterxml.jackson.databind.JsonNode KeyValueDict2JsonNode(KeyValueDict dict)
public static java.util.List<com.fasterxml.jackson.databind.JsonNode> KeyValueDictList2JsonNodeList(java.util.List<KeyValueDict> dicts)
public static java.util.Map<java.lang.Integer,java.lang.String> getHttpErrorMessages()
public static java.lang.Exception convertException(java.lang.Exception e)
public static java.io.IOException getHttpExceptionByCode(int code,
java.lang.String message)
protected java.lang.String getDateStrByStamp(long value)