当前位置:网站首页>@Accessors注解作用指定前缀遵守驼峰命名
@Accessors注解作用指定前缀遵守驼峰命名
2022-07-03 03:08:00 【&友情岁月&】
Accessors翻译是存取器。通过该注解可以控制getter和setter方法的形式。
@Accessors(fluent = true)
使用fluent属性,getter和setter方法的方法名都是属性名,且setter方法返回当前对象
@Data
@Accessors(fluent = true)
class User {
private Integer id;
private String name;
// 生成的getter和setter方法如下,方法体略
public Integer id(){}
public User id(Integer id){}
public String name(){}
public User name(String name){}
}
@Accessors(chain = true)
使用chain属性,setter方法返回当前对象
@Data
@Accessors(chain = true)
class User {
private Integer id;
private String name;
// 生成的setter方法如下,方法体略
public User setId(Integer id){}
public User setName(String name){}
}
@Accessors(prefix = “f”)
使用prefix属性,getter和setter方法会忽视属性名的指定前缀(遵守驼峰命名)
@Data
@Accessors(prefix = "f")
class User {
private Integer fId;
private String fName;
// 生成的getter和setter方法如下,方法体略
public Integer id(){}
public void id(Integer id){}
public String name(){}
public void name(String name){}
}
边栏推荐
- MySQL practice 45 lecture [row lock]
- Idea format code idea set shortcut key format code
- The solution of "the required function is not supported" in win10 remote desktop connection is to modify the Registry [easy to understand]
- How to make backgroundworker return an object
- Basic information of Promethus (I)
- MySql实战45讲【全局锁和表锁】
- Pytest (6) -fixture (Firmware)
- Serious security vulnerabilities reported by moxa mxview network management software
- I2C 子系统(四):I2C debug
- Can I use read-only to automatically implement properties- Is read-only auto-implemented property possible?
猜你喜欢
Use of El tree search method
Segmentation fault occurs during VFORK execution
Vs Code configure virtual environment
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
[error record] the parameter 'can't have a value of' null 'because of its type, but the im
Vs 2019 configure tensorrt to generate engine
I2C subsystem (I): I2C spec
敏捷认证(Professional Scrum Master)模拟练习题-2
Spark on yarn资源优化思路笔记
Sous - système I2C (IV): débogage I2C
随机推荐
Distributed transaction
SqlServer行转列PIVOT
tensor中的append应该如何实现
I2C subsystem (III): I2C driver
Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception
How to make backgroundworker return an object
Can I use read-only to automatically implement properties- Is read-only auto-implemented property possible?
Agile certification (professional scrum Master) simulation exercises
从输入URL到页面展示这中间发生了什么?
C language beginner level - pointer explanation - paoding jieniu chapter
Variable declarations following if statements
45 lectures on MySQL [index]
MySQL practice 45 lecture [transaction isolation]
Use cve-2021-43893 to delete files on the domain controller
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
I2C 子系统(四):I2C debug
Chart. JS multitooltip tag - chart js multiTooltip labels
Pytest (6) -fixture (Firmware)
超好用的日志库 logzero
The core idea of performance optimization, dry goods sharing