The get set method automatically generated by eclipse automatically adds text comments, and the comment content includes the documentation comments we added in the field .

When coding and writing entity classes, I found that an entity class has many fields to be annotated. They are all private and cannot be accessed directly. The documentation comments we added when writing did not work, but the automatically generated get , the documentation comments of the set method do not meet our requirements (the documentation comments in the fields are not included), so it is very tangled. I saw some great gods on the Internet and have a solution, just try it out, take it out and share it with everyone!


Modified renderings:


step:

1: Search for org.eclipse.jdt.ui_*.jar in myeclipse/eclisp (* is the version number)

2: Change the jar file to .rar format and open it (it is best to back up the jar file before modifying)

3: Find the file GetterSetterUtil.class in the directory \org\eclipse\jdt\internal\corext\codemanipulation, download address http://download.csdn.net/detail/ydcun/5521921

4: Open the development tools and find Window->Preferences->Java->CodeStyle->Code Templates->Comments->Getters/Setters

  getters:

[java]  view plain copy
  1. /**   
  2.  * get ${bare_field_name}   
  3.  * @return ${bare_field_name} ${bare_field_name}   
  4.  */    
setters:

[java]  view plain copy
  1. /**   
  2.  * set ${bare_field_name}   
  3.  * @param ${bare_field_name} ${bare_field_name}   
  4.  */    

Note: Check Generate method comments when generating Get/Set methods

When coding and writing entity classes, I found that an entity class has many fields to be annotated. They are all private and cannot be accessed directly. The documentation comments we added when writing did not work, but the automatically generated get , the documentation comments of the set method do not meet our requirements (the documentation comments in the fields are not included), so it is very tangled. I saw some great gods on the Internet and have a solution, just try it out, take it out and share it with everyone!


Modified renderings:


step:

1: Search for org.eclipse.jdt.ui_*.jar in myeclipse/eclisp (* is the version number)

2: Change the jar file to .rar format and open it (it is best to back up the jar file before modifying)

3: Find the file GetterSetterUtil.class in the directory \org\eclipse\jdt\internal\corext\codemanipulation, download address http://download.csdn.net/detail/ydcun/5521921

4: Open the development tools and find Window->Preferences->Java->CodeStyle->Code Templates->Comments->Getters/Setters

  getters:

[java]  view plain copy
  1. /**   
  2.  * get ${bare_field_name}   
  3.  * @return ${bare_field_name} ${bare_field_name}   
  4.  */    
setters:

[java]  view plain copy
  1. /**   
  2.  * set ${bare_field_name}   
  3.  * @param ${bare_field_name} ${bare_field_name}   
  4.  */    

Note: Check Generate method comments when generating Get/Set methods

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325516182&siteId=291194637