rigd-loxia / builder-generator

Yet another builder generator. Primary style of this generator will be fluent wither, although other styles will be supported in the future. There is support for builder chaining.
Apache License 2.0
2 stars 2 forks source link

Generate builder which passes itself to the constructor #31

Closed Zegveld closed 11 months ago

Zegveld commented 11 months ago

Instead of getting a large constructor which is then called by the builder, I want it to pass itself so that I have a cleaner constructor.

for example:

public class MyClass {
// 10 final fields
MyClass ( String field1, int field2, boolean field3, MyEnum field4, String field5, String field6, String field7, String field8, String field9, String field10 ) {
  // 10 times setting argument to field
}

would become:

public class MyClass {
// 10 final fields
MyClass(MyClassBuilder builder) {
  // 10 times setting builder.field to field
}