mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-15 04:18:44 +00:00
[SuperBuilder] allow constructor customization
This commit is contained in:
1 parent
faa70bd21d
commit
48b1f17f7e
5 files changed
+81
-15
No files matched your search
@@ -23,6 +23,13 @@ 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);
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private static final class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> {
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@@ -39,14 +46,6 @@ public class SuperBuilderCustomized {
|
||||
return new SuperBuilderCustomized.Parent(this);
|
||||
}
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
protected Parent(final SuperBuilderCustomized.Parent.ParentBuilder<?, ?> b) {
|
||||
this.field1 = b.field1;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public static SuperBuilderCustomized.Parent.ParentBuilder<?, ?> builder() {
|
||||
return new SuperBuilderCustomized.Parent.ParentBuilderImpl();
|
||||
}
|
||||
}
|
||||
public static class Child extends Parent {
|
||||
private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
|
||||
|
||||
Reference in new issue
Block a user