自定义对象的of生成逻辑
依赖于lombok的注解
@RequiredArgsConstructor(staticName = "of")
- 写法
@Accessors(chain = true)
@Setter
@Getter
@RequiredArgsConstructor(staticName = "of")
public class Student {
@NonNull private String name;
private int age;
}
- 应用
Student student = Student.of("xiaoming").setAge(20);
标签:RequiredArgsConstructor,自定义,对象,staticName,private,生成,Student
From: https://www.cnblogs.com/PythonOrg/p/17712382.html