Gson解析泛型数据

2018-06-01  本文已影响144人  Duke丶Lee

解析BaseBean<T>格式泛型数据

class Business{

private String description;

/**Getter And Setter **/

}

反序列化BaseBean<Business>泛型类:

String json = "json格式数据";

Gson gson = new Gson();

Type type = new TypeToken<BaseBean<Business>>(){};

BaseBean<Business> bean = gson.fromJson(json,type);

上一篇下一篇

猜你喜欢

热点阅读