Join GitHub today
More fine grained control over constructors #152
As far as I can tell, lombok will only generate a single constructor for a
I would love a way to be able to generate this constructor as well as a
Right now, I have a lot of boilerplate code that looks like this:
I have to write both, because lombok only wants to generate one constructor
I'd love to be able to have lombok generate the constructor code for me:
Lombok is great. Keep up the good work!
We'll like tackle this for the 0.9.3 release. Link to the discussion on the googlegroups:
referenced this issue
Jul 14, 2015
We've now added this to lombok 0.9.3 (Burrowing Whale). We still have to update the site documentation, but, in short:
will generate no args constructor (and error out if that's not possible due to final fields), required args constructor (all final fields and all fields with constraints such as @ NonNull - this is what @ Data does by default), and a constructor for ALL fields. You can choose the access level (public by default) for any of them, and you can turn any of them into a static constructor via the staticName annotation argument.
You can play with this feature by installing the edge release of Burrowing Whale, available here:
Leaving this issue open until we update the docs.
Done in commit 067ecf7