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

后端 未结 2 1103
無奈伤痛
無奈伤痛 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:01

    Yes, you have to use @ NonNull on such fields, it will result in a null check in the generated constructor.

提交回复
热议问题