How to add comment block to methods in Eclipse?
Is there an easy of adding a comment block (Javadoc开发者_如何学Go style) to every method in an Eclipse project and possibly classes so I can fill in them later?
As suggested you can do it method-per-method (Source -> Generate element comment) or ALT+SHIFT+J
but I find it a very bad idea. Comments are only useful when they give an additional information. When you feel more information is needed add it.
Having comments on setters like "sets the value" or worse automatically generated comments it not useful at all.
To add a comment over the method select getUser or take the cursor before getUser and press ALT + SHIFT + J It will add the comment on top of your method
/*
* @param
* @return User
*/
public User getUser();
Under
Window | Preferences | Java | Code Style | Code Templates
you will find 2 features:
- Automatically add comments for new methods or types
- Comments | Methods | Edit...
You can edit the generated comment block by use of eclipse variables or your static Javadoc text.
simple thing is ,you just type /** and press Enter on the top of method ,where you want generate comment .it automatically generates the element comment .No need to go for long Key ins.
Maybe you are looking for this
http://jautodoc.sourceforge.net/
Mac Users: ⌃-⌥-J
- Option - ⌥
- Control - ⌃
Windows Users: Shift-Alt-J
PS: Make sure you have JAutodoc plugin installed
use these following steps an you will do it easily. in eclipse go to Project -> generate javadoc ->press enter and then select your project to be documented.
精彩评论