【问题标题】:How to add custom comments to google endpoint如何向谷歌端点添加自定义评论
【发布时间】:2013-06-08 01:16:30
【问题描述】:

我正在使用 Google Eclipse 插件来创建一个应用引擎连接的 android 应用。在 android 项目中,我只能看到关于我的端点方法的通用无意义 cmets。有没有办法让我的自定义 cmets 显示?

(回想一下,在 Eclipse 中,您可以通过将鼠标放在方法名称上来查看方法的 Java 文档。)

这是一个通用注释的示例:

Create a request for the method "register".
This request holds the parameters needed by the Pouton server.  After setting any
optional parameters, call the `Register.execute()` method to invoke the remote operation.

【问题讨论】:

  • 那个通用注释就是端点方法的Javadoc,不是吗?您想知道如何更改端点方法的 Javadoc?

标签: google-app-engine endpoint google-cloud-endpoints gae-eclipse-plugin


【解决方案1】:

更改 Endpoint 方法的 Javadoc 就像更改任何其他方法的 Javadoc...有关详细信息,请参阅 Oracle Javadoc documentation。

基本上你必须去.java文件和你的端点的源代码(如果你自动生成端点,文件将有名称YourClassEndpoint.java),你只需要去方法哪个你想改Javadoc,改方法上面的注释。

像这样:

/**
 * Here is your generic comment, just delete this text and add your own...
 * It can be as long as you want...
 *
 * @param Here the explanation of the parameter "bar1".
 * @param Here the explanation of the parameter "bar2".
 * @return Here the explanation of the returned value.
 */
public Foo someMethod(Bar bar1, Bar bar2) {
    //...
}

只需在方法顶部添加这种注释,Eclipse(和其他工具)就会知道这些 cmets 代表 Javadoc,并将正确显示它...

【讨论】:

  • 感谢您的回复。我知道如何从 android 本身中做到这一点。但是每次生成端点时,我都必须手动添加所有文档。我想要的是我在服务器端拥有的 cmets 是在生成端点时显示的那些。您可能已经猜到了,我在服务器端的端点类中有 cmets。他们没有出现在 android 端。相反,我得到的是默认文档。
  • @PoutonGerald,好吧,我已经在想这个问题太明显了......无论如何,如果你自动生成端点,你就是从一个简单的 pojo 生成它们上课,对吧?那么,pojo类真的要修改太多次吗??
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-17
相关资源
最近更新 更多