Required arguments are final fields and fields with constraints such as {@code @NonNull}. RequiredArgsConstructor是针对final成员变量去生成有参构造器。
@UtilityClass
1 2 3 4 5 6 7 8 9 10 11
/** * An annotation to create utility classes. * * If a class is annotated with {@code @UtilityClass}, the following things happen to it:<ul> * <li>It is marked final.</li> * <li>If any constructors are declared in it, an error is generated. Otherwise, a private no-args constructor is generated; it throws a {@code UnsupportedOperationException}.</li> * <li>All methods, inner classes, and fields in the class are marked static.</li> * <li><em>WARNING:</em> Do not use non-star static imports to import these members; javac won't be able to figure it out. Use either: * <code>import static ThisType.*;</code> or don't static-import.</li> * </ul> */