Support for multiple constructors is here!

381 views
Skip to first unread message

Reinier Zwitserloot

unread,
Jul 19, 2010, 4:15:58 PM7/19/10
to Project Lombok
RJ, Roel and I just added support for multiple constructors in the
edge release, which we've christened "Burrowing Whale", as the feature
set is now big enough to warrant a name.

We still have to update the site documentation, but, in short:

@NoArgsConstructor
@RequiredArgsConstructor(access=AccessLevel.PROTECTED,
staticName="of")
@AllArgsConstructor

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:

http://projectlombok.org/download-edge.html

NB: By adding such an annotation, that constructor is always generated
even if you write your own as well.

Let us know what you think!

Jonathan

unread,
Jul 19, 2010, 5:57:56 PM7/19/10
to Project Lombok
Cool. Lombok is already very useful and this will only help.
Reply all
Reply to author
Forward
0 new messages