Window--> Java--> code Style--> code Templates--> Comments--> types--> Edit
/**
*
* Project name: ${project_name}
* Class name: ${type_name}
* Class Description:
* Create person: ${user}
* Creation time: ${date} ${time}
* Modified person: ${user}
* Modified time: ${date} ${time}
* Modify the Note:
* @version
*
*/
----------------------------------------------------------------------------------------------------------
To set the entry for the annotation template: Window->preference->java->code style->code Template then expand Comments node is all the elements that need to be set up for annotations. Each element is described individually:
File (files) Comment Label:
/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo} (describe what the file does in a word)
* @author A18ccms a18ccms_gmail_com
* @date ${date} ${time}
* @version V1.0
*/
Type (Types) Comment Label (note for Class):
/**
* @ClassName: ${type_name}
* @Description: ${todo} (the function of this class is described here in one sentence)
* @author A18ccms a18ccms_gmail_com
* @date ${date} ${time}
*
* ${tags}
*/
Field (Fields) Comment Label:
/**
* @Fields ${field}: ${todo} (describe what this variable represents in one sentence)
*/
Constructor tag:
/**
* <p>title: </p>
* <p>description: </p>
* ${tags}
*/
Methods (constructor & Methods) Tags:
/**
* @Title: ${enclosing_method}
* @Description: ${todo} (the function of this method is described here in one sentence)
* @param ${tags} settings file
* @return ${return_type} return type
* @throws
*/
Overlay method (overriding Methods) Label:
/* (non-Javadoc)
* <p>title: ${enclosing_method}</p>
* <p>description: </p>
* ${tags}
* ${see_to_overridden}
*/
Representative method (Delegate Methods) Label:
/**
* ${tags}
* ${see_to_target}
*/
Getter Method Label:
/**
* @return ${bare_field_name}
*/
Setter Method Label:
/**
* @param ${param} to be set ${bare_field_name}
*/
Simple Template Example:
View Plaincopy to Clipboardprint?
<?xml version= "1.0" encoding= "UTF-8" ><templates><template "true" autoinsert= "context=" The annotation "enabled=" true "id=" of the context "deleted=" false "description=" field org.eclipse.jdt.ui.text.codetemplates.fieldcomment "Name=" Fieldcomment ">/**
* @Fields ${field}: ${todo} (describe what this variable represents in one sentence)
*/
</template><template autoinsert= "true" context= "Gettercomment_context" deleted= "false" description= " The annotation "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.gettercomment "name=" gettercomment "of the Getter method >/**
* @return ${bare_field_name}
*/
</template><template autoinsert= "true" context= "Constructorcomment_context" deleted= "false" description= " The annotation of the created constructor "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.constructorcomment "Name=" constructorcomment ">/**
* <p>title:${file_name} </p>
* <p>description: Constructors </p>
* ${tags}
*/
</template><template autoinsert= "true" context= "Filecomment_context" deleted= "false" description= "created Java file Annotation "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.filecomment "name=" Filecomment ">/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo} (describe what the file does in a word)
* @author Daiguangjiu
* @date ${date} ${time}
* @version V1.0
*/
</template><template autoinsert= "true" context= "Settercomment_context" deleted= "false" description= " The annotation "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.settercomment "name=" settercomment "of the setter method >/**
* @param ${param} to be set ${bare_field_name}
*/</template><template autoinsert= "true" context= "Typecomment_context" deleted= "false" description= " The annotation for the type created is "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.typecomment "name=" Typecomment ">/**
* @author ${user}
*
* ${tags}
*/</template><template autoinsert= "true" context= "Delegatecomment_context" deleted= "false" description= " Represents the annotation of the method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.delegatecomment "name=" Delegatecomment ">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert= "true" context= "Overridecomment_context" deleted= "false" description= " Overrides the method's annotation "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.overridecomment "name=" Overridecomment ">/** ( Non-Javadoc)
* <p>title: ${enclosing_method}</p>
* <p>description: </p>
* ${tags}
* ${see_to_overridden}
*/</template><template autoinsert= "true" context= "Methodcomment_context" deleted= "false" description= " Annotations for non-overriding methods "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.methodcomment "name=" Methodcomment ">/**
* ${tags}
*/</template></templa
<?xml version= "1.0" encoding= "UTF-8" ><templates><template "true" autoinsert= "context=" The annotation "enabled=" true "id=" of the context "deleted=" false "description=" field org.eclipse.jdt.ui.text.codetemplates.fieldcomment "Name=" Fieldcomment ">/**
* @Fields ${field}: ${todo} (describe what this variable represents in one sentence)
*/
</template><template autoinsert= "true" context= "Gettercomment_context" deleted= "false" description= " The annotation "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.gettercomment "name=" gettercomment "of the Getter method >/**
* @return ${bare_field_name}
*/
</template><template autoinsert= "true" context= "Constructorcomment_context" deleted= "false" description= " The annotation of the created constructor "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.constructorcomment "Name=" constructorcomment ">/**
* <p>title:${file_name} </p>
* <p>description: Constructors </p>
* ${tags}
*/
</template><template autoinsert= "true" context= "Filecomment_context" deleted= "false" description= "created Java file Annotation "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.filecomment "name=" Filecomment ">/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo} (describe what the file does in a word)
* @author Daiguangjiu
* @date ${date} ${time}
* @version V1.0
*/
</template><template autoinsert= "true" context= "Settercomment_context" deleted= "false" description= " The annotation "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.settercomment "name=" settercomment "of the setter method >/**
* @param ${param} to be set ${bare_field_name}
*/</template><template autoinsert= "true" context= "Typecomment_context" deleted= "false" description= " The annotation for the type created is "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.typecomment "name=" Typecomment ">/**
* @author ${user}
*
* ${tags}
*/</template><template autoinsert= "true" context= "Delegatecomment_context" deleted= "false" description= " Represents the annotation of the method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.delegatecomment "name=" Delegatecomment ">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert= "true" context= "Overridecomment_context" deleted= "false" description= " Overrides the method's annotation "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.overridecomment "name=" Overridecomment ">/** ( Non-Javadoc)
* <p>title: ${enclosing_method}</p>
* <p>description: </p>
* ${tags}
* ${see_to_overridden}
*/</template><template autoinsert= "true" context= "Methodcomment_context" deleted= "false" description= " Annotations for non-overriding methods "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.methodcomment "name=" Methodcomment ">/**
* ${tags}
*/</template></templa
Example 2:
View Plaincopy to Clipboardprint?
<?xml version= "1.0" encoding= "UTF-8"?>
<templates>
<template
Autoinsert= "false"
context= "Constructorcomment_context"
Deleted= "false"