-
Open the Eclipse/myeclipse tool, open or create a Java project, click the menu window->preferences Pop-up Preferences window
-
Expand the list of Java->code style->code template options on the left to see all the elements that need to be annotated
-
Expand right-side template options comments to see the types of comment templates you can set, including Files,types,fields,constructors,methods, and more
-
Click Types, the pattern section below displays the contents of the Class Comment template, click the Edit button on the right to modify the content of the comment template
-
For example: I am accustomed to the following annotation format:/*** <p>title: </p>* <p>description: </p>* <p>company: </p> * @ Author * @date * *
So enter the above content in the pattern area
-
Place your mouse behind the title, click the Insert Variable button below, and in the list of variables that pops up, select TypeName
-
Similarly, enter ${user} after @author, enter ${date} ${time} variable after @date, and such annotations are defined.
-
In the actual development process, after a new class, by entering/**, and then enter automatically follow the definition of the Comment template format to fill the comment content, you can also press Shift+alt+j shortcut key to complete the action
-
MyEclipse How to set up a personalized code comment template