Java Lombok: Omitting one field in @AllArgsConstructor? Java Lombok: Omitting one field in @AllArgsConstructor? java java

Java Lombok: Omitting one field in @AllArgsConstructor?


No that is not possible. There is a feature request to create a @SomeArgsConstructor where you can specify a list of involved fields.

Full disclosure: I am one of the core Project Lombok developers.


Alternatively, you could use @RequiredArgsConstructor. This adds a constructor for all fields that are either @NonNull or final.

See the documentation


A good way to go around it in some cases would be to use the @Builder