Google app engine 我可以在Google Cloud端点中返回一个泛型吗
当我返回泛型时,端点api文件似乎消失了。粘贴示例代码Google app engine 我可以在Google Cloud端点中返回一个泛型吗,google-app-engine,google-cloud-endpoints,Google App Engine,Google Cloud Endpoints,当我返回泛型时,端点api文件似乎消失了。粘贴示例代码 @ApiMethod public RestResponse<Container> testGeneric() { Container container = new Container(); container.testLong = (long)4345; container.testDate = new Date(); container.testString = "sathya";
@ApiMethod
public RestResponse<Container> testGeneric() {
Container container = new Container();
container.testLong = (long)4345;
container.testDate = new Date();
container.testString = "sathya";
container.testDouble = 123.98;
container.testInt = 123;
RestResponse<Container> response = new RestResponse<Container>();
response.t = container;
return response;
}
@ApiMethod
公共Response testGeneric(){
容器=新容器();
container.testLong=(long)4345;
container.testDate=新日期();
container.testString=“sathya”;
container.testDouble=123.98;
container.testInt=123;
RestResponse response=新的RestResponse();
响应。t=容器;
返回响应;
}
这是端点中的一个bug吗?这样的事情是完全不允许的吗
问候,,
Sathya我不认为这是一个bug,但它只是不受支持,就像您不能从端点返回
字符串一样
为了检查问题出在哪里,如果您使用的是Eclipse的Google插件,您可以查看窗口->显示视图->错误日志-/code>下的错误日志以获得更多信息。Google文档说返回类型“必须是POJO,…”,而与泛型无关,因此我认为这是一个bug。