当前位置:网站首页>@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){}
}
边栏推荐
- Destroy the session and empty the specified attributes
- 处理数据集,使用LabelEncoder将所有id转换为从0开始
- [shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling
- C#通用接口调用
- The core idea of performance optimization, dry goods sharing
- MySql实战45讲【全局锁和表锁】
- As a leader, how to control the code version and demand development when the epidemic comes| Community essay solicitation
- labelimg生成的xml文件转换为voc格式
- Kubernetes family container housekeeper pod online Q & A?
- Idea set method call ignore case
猜你喜欢
随机推荐
Parameter index out of range (1 > number of parameters, which is 0)
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
Source code analysis | resource loading resources
45 lectures on MySQL [index]
[C language] MD5 encryption for account password
Chart. JS multitooltip tag - chart js multiTooltip labels
Vs Code configure virtual environment
Cron表达式介绍
[combinatorics] Application of exponential generating function (multiple set arrangement problem | different balls in different boxes | derivation of exponential generating function of odd / even sequ
open file in 'w' mode: IOError: [Errno 2] No such file or directory
Do you really understand relays?
How to use asp Net MVC identity 2 change password authentication- How To Change Password Validation in ASP. Net MVC Identity 2?
Edit and preview in the back pipe to get the value writing method of the form
超好用的日志库 logzero
Andwhere multiple or query ORM conditions in yii2
I2C subsystem (IV): I2C debug
Getting started | jetpack hilt dependency injection framework
PHP constructor with parameters - PHP constructor with a parameter
用docker 連接mysql的過程
I2C subsystem (II): I3C spec