Intellij idea 生成带注释的get/set

自带的 Alt+ Insert 中的 Getter and  Setter 生成的属性,不能将 private 字段中的注释带过去,比较尴尬。可以通过两种试。

1. 修改模板:这种方法不能得到 private 字段上的属性

2. 下载插件:https://plugins.jetbrains.com/plugin/11292-generategsdoc/ 这种不能指定选哪些属性


【了解一下而已,真正使用的时候 Ctrl+Q会有注释出来的】

 

 


 

1. 修改模板:这种方法不能得到 private 字段上的属性

 

 新添加一个模板,将default里面的复制过来。将红框加的代码贴上去

/*
* @return the $field.name
*/

 

 

 

 

 

 

 

 

 

 

 


2. 下载插件:https://plugins.jetbrains.com/plugin/11292-generategsdoc/ 这种不能指定选哪些属性

 插件下载后随便放到某个文件夹下,然后在 setting -> plugins ->  Install plugin from disk ,选择该插件后重启 Intellij

 

 

 

 

 Alt + InnSert 将会生成带注释的属性,插到类的最后面,不过不能指定哪些字段生成,不太喜欢。

 

posted @ 2020-09-28 14:11  VipSoft  阅读(2228)  评论(0编辑  收藏  举报