When you use Eclipse to write Java code, the automatically generated comment information is generated in a pre-set format, such as the attribute value of author.
We can set the information we want to display in eclipse.
Now look at how to modify our user name is the author information: Click Windows->preferences->java->code style->code Templates,
Then we can select the comments in the right window, corresponding to the specific comments option, we can edit the specific annotation information to set.
For example, we want to set the author's author information and date information at the beginning of a Java file.
Select types, click Edit, and
/**
* @author ${user}
* ${tags}
*/
Delete the ${user} and change it to Hanyankai so that the author information becomes Hanyankai; Click Insert Variable, select Date, and the date information is automatically generated.
After we have set up the test, the automatically generated comment information is:
/**
* @author Hanyankai
* 2009-11-27
*/
For the same steps, we can also edit settings for other annotation information such as constructors and so on.
When you use the mouse, place it anywhere inside the method where you want to add the comment. If you click Add Javadoc Comment under source code in the menu bar, or use the shortcut key Alt Shift J, Eclipse automatically adds a comment before the method.
The specification for annotations is as follows:
File Comment Tags:
/**
* <p>title: ${file_name}</p>
* <p>description: </p>
* <p>copyright:copyright (c) 2007</p>
* <p>Company:zkyr</p>
* @author Uu
* @date ${date}
* @version 1.0
*/
Type Comment Label (note for Class):
/**
* <p>title: ${type_name}</p>
* <p>description: </p>
* <p>Company:zkyr</p>
* @author Uu
* @date ${date}
*/
Field Comment Label:
/** ${field}*/
Constructor Tags:
/**
* <p>title: </p>
* <p>description: </p>
* ${tags}
*/
Method Tags:
/**
* <p>title: ${enclosing_method}</p>
* <p>description: </p>
* ${tags}
*/
Override method Label:
/* (non-Javadoc)
* <p>title: ${enclosing_method}</p>
* <p>description: </p>
* ${tags}
* ${see_to_overridden}
*/
Represent method Tags:
/**
* ${tags}
* ${see_to_target}
*/
Getter Method Tags:
/**
* @return ${bare_field_name}
*/
Setter Method Tags:
/**
* @param ${param} to set the ${bare_field_name}
*/
From: http://blog.csdn.net/aaronuu/article/details/7065928