lombok 基础注解之 @RequiredArgsConstructor

时间:2025-04-03 07:05:09
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); } }