省去Set、Get方法

版权声明:LT https://blog.csdn.net/LitongZero/article/details/82782715

在IDEA中,可以通过安装   lombok-plugin-0.19-2018.1  插件,来省去经常要写的Set、Get方法。

离线安装插件下载地址

http://plugins.jetbrains.com/plugin/6317-lombok-plugin

安装方法:可以参考(离线安装、在线安装)

https://blog.csdn.net/LitongZero/article/details/81566750

支持注解:官方说明 

 各种说明

使用方法(以Get、Set为例)

之前我们写的

public class FirmwareTypeListVo {

    private String username;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

}

使用插件后

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class FirmwareTypeListVo {

    private String username;
}

只需在类上添加两个注解,就可以达到类中所有变量加上Set、Get方法了。

猜你喜欢

转载自blog.csdn.net/LitongZero/article/details/82782715