I have two classes like this:
@Builder
public class Parent {
final int a;
final int b;
public class static ParentBuilder {
public ParentBuilder setAllTo(final int value) {
return a(value).b(value);
}
}
}
public class Child extends Parent {
final in c;
@Builder(builderMethodName = "childBuilder")
public Child(final int a, final int b, final int c) {
super(a, b);
this.c = c;
}
}
My classes are growing up and got more and more fields.
And this is a reson to use the @SuperBuilder. But how can I add customized builder methods?
The same way dosent work. I tried this way:
@SuperBuilder
public abstract class Parent { //yes, I want a abstract parent
final int a;
final int b;
public class static ParentBuilder {
public ParentBuilder setAllTo(final int value) {
return a(value).b(value);
}
}
}
@SuperBuilder
public class Child extends Parent {
final in c;
}
Edit
Its not possible yet. When I try to do it the same way, then I got a exception: @SuperBuilder does not support customized builders. Use @Builder instead.
The override is a inner class like this:
public abstract static class ParentBuilder<C extends ParentBuilder, B extends Parent.ParentBuilder<C, B>> {
// custom imlementations here
}