[SuperBuilder] allow constructor customization

This commit is contained in:
Jan Rieke authored and Roel Spilker committed 2020-05-28 21:18:35 +02:00
1 parent faa70bd21d
commit 48b1f17f7e
5 files changed
+81 -15

No files matched your search

@@ -14,6 +14,16 @@ public class SuperBuilderCustomized {
}
}
int field1;
protected Parent(ParentBuilder<?, ?> b) {
if (b.field1 == 0)
throw new IllegalArgumentException("field1 must be != 0");
this.field1 = b.field1;
}
public static SuperBuilderCustomized.Parent.ParentBuilder<?, ?> builder(int field1) {
return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1);
}
}
@lombok.experimental.SuperBuilder