Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Google HTTP客户端库的数组中的泛型类型_Java_Http_Google Http Client - Fatal编程技术网

Java 使用Google HTTP客户端库的数组中的泛型类型

Java 使用Google HTTP客户端库的数组中的泛型类型,java,http,google-http-client,Java,Http,Google Http Client,我有一个基本http响应,如下所示: { "data" : [], "total" : 0, "hasMore" : false } 数据中可以是任何对象-用户、提要等 所以我想创建基类,比如 public class BaseDataReponse<T> { @Key public List<T> data; @Key public Integer total; @Key public Boolean hasMore; } 公共类BaseDataRes

我有一个基本http响应,如下所示:

{ 
"data" : [], 
"total" : 0, 
"hasMore" : false
}
数据中可以是任何对象-用户、提要等

所以我想创建基类,比如

public class BaseDataReponse<T> {

@Key
public List<T> data;

@Key
public Integer total;

@Key
public Boolean hasMore;

}
公共类BaseDataResponse{
@钥匙
公开名单数据;
@钥匙
公共整数合计;
@钥匙
公共卫生服务更多;
}
我可以在Android库的改造中这样做

但我不明白如何在谷歌HTTP客户端库中做到这一点