Is there a way to set 'not null' for all params of @AllArgsConstructor (lombok)

后端 未结 2 1122
無奈伤痛
無奈伤痛 2021-01-19 23:22

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

2条回答
  •  孤独总比滥情好
    2021-01-20 00:07

    @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.

提交回复
热议问题