Google Cloud Endpoints - 返回资源获取器中的另一个资源

时间:2014-07-09 19:54:14

标签: java api rest google-cloud-endpoints

因此,典型的Cloud Endpoints API方法可能如下所示。

@ApiMethod(path = "myresources/{id}")
public MyResource get(@Named("id") int id) { … }

但是如果MyResouce类中的getter返回MySecondResource会怎样?

从技术上讲,此处列出了支持的类型。

https://developers.google.com/appengine/docs/java/endpoints/paramreturn_types

但是一轮的工作是什么。显然,一个资源应该能够有一个返回另一个的getter。

1 个答案:

答案 0 :(得分:1)

端点支持POJO getter getMySecondResource()。你可以懒惰地在getter中加载值。

您提到的链接中的列表是针对方法参数的。