Myeclipse/Eclisp自动生成的get set方法 加上文本注释

步骤:

1:在myeclipse/eclisp安装目录中搜索找到org.eclipse.jdt.ui_*.jar(*是版本号)

2:将jar用解压rar方式打开(记得保存源文件)

3:找到\org\eclipse\jdt\internal\corext\codemanipulation这个目录下的GetterSetterUtil.class这个文件,然后下载https://pan.baidu.com/s/19dgol_5lDIwjrRDePTQ70Q这个java文件(链接失效可以下载https://download.csdn.net/download/baidu_33620037/10975711)

4:把GetterSetterUtil.java文件编译成GetterSetterUtil.class文件替换掉原来的GetterSetterUtil.class这个文件

5:打包解压过的文件可以仿照下面链接    https://blog.csdn.net/qq_24089175/article/details/79589709

6:进入开发工具找到Window->Preferences->Java->CodeStyle->Code Templates->Comments->Getters/Setters

设置getters为:

/**  
 * 获取${bare_field_name}  
 * @return ${bare_field_name} ${bare_field_name}  
 */
设置setters为:
/**  
 * 设置${bare_field_name}  
 * @param ${bare_field_name} ${bare_field_name}  
 */

新建一个javaBean,Alt+shift+s+r,alt+a(全选) 快捷键 自动生成生成Get/Set方法 记着勾选上Generate method comments 

效果如下:
     /** 员工代码 */
    @Column(length = 50,unique = true, nullable = false)
    private String code;

    /**  
     * 获取员工代码  
     * @return code 员工代码  
     */
    public String getCode() {
        return code;
    }

    /**  
     * 设置员工代码  
     * @param code 员工代码  
     */
    public void setCode(String code) {
        this.code = code;
    }

猜你喜欢

转载自blog.csdn.net/baidu_33620037/article/details/87930065