Search code examples
javasyntaxconstructorfieldlombok

Java Lombok: Omitting one field in @AllArgsConstructor?


If I specify @AllArgsConstructor using Lombok, it will generate a constructor for setting all the declared (not final, not static) fields. Is it possible to omit some field and this leave generated constructor for all other fields?


Solution

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