maven 导包:
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
@Accessors翻译是存取器。通过该注解可以控制getter和setter方法的形式。
@Accessors 注解用来配置lombok如何产生和显示getters和setters的方法。@Accessors注解既可以注解在类上也可以注解在属性上,@Accessors有三个属性如下:
*
fluent
*
chain
*
prefix
1、@Accessors(fluent = “true/false”)
fluent为一个布尔值,中文含义是流畅的,默认为false, 如果为true 生成的get/set方法则没有set/get前缀,都是基础属性名, 且setter方法返回当前对象

注:fluent:为true时,默认设置chain为true,setter的方法名修改为字段名
2、@Accessors(chain = “true/false”)
chain为一个布尔值,如果为true生成的set方法返回this,为false生成的set方法是void类型。默认为false,除非当fluent为true时,chain默认则为true, chain = true 是,对对象设置时候可以使用Lambda表达式。


3、@Accessors(prefix = “f”)
使用prefix属性,getter和setter方法会忽视属性名的指定前缀(遵守驼峰命名)

原文链接: https://onlyou.blog.csdn.net//article/details/94430336