public class ApiResult extends Object
http://wiki.fasterxml.com/JacksonInFiveMinutes JSON TYPE JAVA TYPE object LinkedHashMap<String,Object> array ArrayList<Object> string String number (no fraction) Integer, Long or BigInteger (smallest applicable) number (fraction) Double (configurable to use BigDecimal) true|false Boolean null null
限定符和类型 | 方法和说明 |
---|---|
static ApiResult |
create(String jsonStr)
通过 json 创建 ApiResult 对象,等价于 new ApiResult(jsonStr)
|
<T> T |
get(String name) |
BigDecimal |
getBigDecimal(String name) |
BigInteger |
getBigInteger(String name) |
Boolean |
getBoolean(String name) |
Double |
getDouble(String name) |
Integer |
getErrorCode() |
String |
getErrorMsg() |
Integer |
getInt(String name) |
String |
getJson() |
List |
getList(String name) |
Long |
getLong(String name) |
Map |
getMap(String name) |
String |
getStr(String name) |
boolean |
isAccessTokenInvalid()
判断 API 请求结果失败是否由于 access_token 无效引起的
无效可能的情况 error_code 值:
40001 = 获取access_token时AppSecret错误,或者access_token无效(刷新后也可以引起老access_token失效)
42001 = access_token超时
42002 = refresh_token超时
40014 = 不合法的access_token
|
boolean |
isSucceed()
APi 请求是否成功返回
|
String |
toString() |
public ApiResult(String jsonStr)
jsonStr
- json字符串public static ApiResult create(String jsonStr)
jsonStr
- json字符串public String getJson()
public boolean isSucceed()
public Integer getErrorCode()
public String getErrorMsg()
public <T> T get(String name)
public BigInteger getBigInteger(String name)
public BigDecimal getBigDecimal(String name)
public boolean isAccessTokenInvalid()
Copyright © 2017. All rights reserved.