```java public R setData(Object data) { put("data", data); return this; }
// 利用fastjson进行反序列化 public T getData(TypeReference typeReference) { Object data = get("data"); String jsOnString= JSON.toJSONString(data); T t = JSON.parseObject(jsonString, typeReference); return t; }
// 利用fastjson进行反序列化 public T getData(String key, TypeReference typeReference) { Object data = get(key); String jsOnString= JSON.toJSONString(data); T t = JSON.parseObject(jsonString, typeReference); return t; } ```
#### 2. 测试改造后的R对象
改造完R对象后,可以通过以下方式正常使用`setData`方法往R对象里面设置参数`data`:
```java R skusHasStock = wareFeignService.getSkusHasStock(skuIdList); TypeReference> typeReference = new TypeReference>() {}; List data = skusHasStock.getData(typeReference); ```
Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ...
[详细]