I\'m using the @AllArgsConstructor
annotation in my class and want to be sure that arguments will be not null.
Is there a way to modify this annotation to make
Yes, you have to use @ NonNull
on such fields, it will result in a null check in the generated constructor.
@RequiredArgsConstructor
Generates a constructor with required arguments. Required arguments are final fields and fields with constraints such as @NonNull. Complete documentation is found at the project lombok features page for @Constructor . Even though it is not listed, this annotation also has the onConstructor parameter. See the full documentation for more details.