lombok 基础注解之 @RequiredArgsConstructor
public class ChengXiao {
private String name;
private final int age;
@NonNull
private String phone;
@Deprecated
private ChengXiao(int age, @NonNull String phone) {
if (phone == null)
throw new NullPointerException("phone is marked non-null but is null");
this.age = age;
this.phone = phone;
}
protected static ChengXiao newInstance(int age, @NonNull String phone) {
return new ChengXiao(age, phone);
}
}