[SuperBuilder] allow constructor customization

This commit is contained in:
Jan Rieke
2020-05-01 23:56:17 +02:00
committed by Roel Spilker
parent faa70bd21d
commit 48b1f17f7e
5 changed files with 81 additions and 15 deletions
@@ -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