How can I generate Javadoc comments in Eclipse? [duplicate]

*爱你&永不变心* 提交于 2019-12-04 07:39:57

问题


Possible Duplicate:
Javadoc template generator

Is there a way to generate Javadoc comments in Eclipse? If so, what is it?


回答1:


For me the /**<NEWLINE> or Shift-Alt-J (or --J on a Mac) approach works best.

I dislike seeing Javadoc comments in source code that have been auto-generated and have not been updated with real content. As far as I am concerned, such javadocs are nothing more than a waste of screen space.

IMO, it is much much better to generate the Javadoc comment skeletons one by one as you are about to fill in the details.




回答2:


Shift-Alt-J is a useful keyboard shortcut in Eclipse for creating Javadoc comment templates.

Invoking the shortcut on a class, method or field declaration will create a Javadoc template:

public int doAction(int i) {
    return i;
}

Pressing Shift-Alt-J on the method declaration gives:

/**
 * @param i
 * @return
 */
public int doAction(int i) {
    return i;
}



回答3:


JAutoDoc:

an Eclipse Plugin for automatically adding Javadoc and file headers to your source code. It optionally generates initial comments from element name by using Velocity templates for Javadoc and file headers...




回答4:


You mean menu Project -> Generate Javadoc ?




回答5:


At a place where you want javadoc, type in /**<NEWLINE> and it will create the template.



来源:https://stackoverflow.com/questions/1777175/how-can-i-generate-javadoc-comments-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!