Add optional feature to generate a builder class for each domain object class.
The builder class provides a fluent interface to build domain objects in a manner that can be easier to work with and read.
Example of builder class use:
Person sam = new PersonBuilder()
.firstName("Sam")
.lastName("Smith")
.phone("1111111111")
.email("
sam@some.com")
.build();
Example using static import:
import static sample.builder.PersonBuilder.person;
import static sample.builder.AddressBuilder.address;
Person sam = person().
.firstName("Sam")
.lastName("Smith")
.phone("1111111111")
.email("
sam@some.com")
.homeAddress(
address().street("111 some way").zip("11111").build())
.build();
Builders always provide a no-args constructor in addition to the minimal constructor. They support setting attributes, single and multi-references into the domain class.
Also, fornax-utilities-xtendtools 1.0.1 which this feature depends on is now in the Fornax repository, so this feature should build clean.