我有基本的http响应,如下所示:
{
"data" : [],
"total" : 0,
"hasMore" : false
}
数据中可以是任何对象 - 用户、FeedItems 等。
所以我想创建类似的基类
public class BaseDataReponse<T> {
@Key
public List<T> data;
@Key
public Integer total;
@Key
public Boolean hasMore;
}
我可以在 Retrofit for Android 库中这样做。
但我无法理解如何在 Google HTTP 客户端库中执行此操作。