When we write Java code using Eclipse, the automatically generated comment information is generated in a pre-set format.
Modify author, date comment format: Open windows->preferences->java->code style->code Templates, click Comments in the right window, you can see a lot of options, We can edit this comment information template.
If we want to set the author information and date information at the beginning of a Java file.
Select types, click Edit, and
/**
* @author ${user}
* ${tags}
*/
Delete the ${user}, change it to the name you want to display, delete ${tags}, click Insert Variable, select Date, and the date information will be generated automatically. When you need to add a comment, click Sources->ganarate Element Comment, or use the shortcut key Alt+shift+j, Eclipse automatically adds a comment before the class.
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:LTGames</p>
* @author LINRZ
* @date ${date}
* @version 1.0
*/Type Comment Label (note for Class):
/**
* <p>title: ${type_name}</p>
* <p>description: </p>
* <p>Company:LTGames</p>
* @author LINRZ
* @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}
*/
Environment Description: windowsxp SP3 Eclipse3.6 Helios Release
Part of the. java File---------------------
Eclipse-->windows-->preferences-->java-->code Style-->code templates-->code-->new Java files--> click the [Edit] button
In the first line of the file, add the following:
Java code
${filecomment}
${package_declaration}
/**
* Creation time: ${date} ${time}
* Project name: ${project_name}
* @author Daniel
* @version 1.0
* @since JDK 1.6.0_21
* File name: ${file_name}
* Class Description:
*/
${typecomment}
${type_declaration}
${filecomment}
${package_declaration}
/**
* Creation time: ${date} ${time}
* Project name: ${project_name}
* @author Daniel
* @version 1.0
* @since JDK 1.6.0_21
* File name: ${file_name}
* Class Description:
*/
${typecomment}
${type_declaration}
Or
Java code
${filecomment}
${package_declaration}
/**
* Filename: ${file_name}
* Copyright:copyright (c) 2010
* company:com
* @version: 1.0
* @since: JDK 1.6.0_21
* Create at: ${date} ${time}
* Description:
*
* Modification History:
* Date Author Version Description
* -----------------------------------------------------------------
* ${date} Daniel 1.0 1.0 Version
* /
${typecomment}
${type_declaration}
${filecomment}
${package_declaration}
/**
* Filename: ${file_name}
* Copyright: Copyright (c)
* Company: com
* @version: 1.0
* @since: JDK 1.6.0_21
* Create at: ${date} ${time}
* Description:
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* ${date} Daniel 1.0 1.0 Version
*/
${typecomment}
${type_declaration}
Ii.. jsp file Part---------------------
eclipse-->windows-->preferences-->web-->jsp files-->editer-->templates-->new JSP File--> Click the [Edit] button
In the first line of the file, add the following:
Java code
<%--
Creation time: ${date}${time}
Founder: Daniel
Related instructions:
jdk1.6.0_21 tomcat6.0.29 servlet2.5
--%>
<%--
Creation time: ${date}${time}
Founder: Daniel
Related instructions:
Jdk1.6.0_21 tomcat6.0.29 servlet2.5
--%>
When you create a. java or. jsp file in this way, Eclipse automatically writes the comments for us. You can also export your own templates for easy use on other machines through the export and import functions.
Eclipse automatically generates feature settings such as author, date comment, and more