From the SuperBUilder
documentation:
You can customize most of the code generated by @SuperBuilder, except for internal methods (e.g. self()). You have to make sure that the builder class declaration headers match those that would have been generated by lombok. Due to the heavy generics usage, we strongly advice to take the uncustomized delomboked code as a reference when customizing @SuperBuilder.
As an example, add an internal class to customize the builder could look like this:
@SuperBuilder(toBuilder = true)
class Report extends BasicReport {
// ...
private String reportType;
public static abstract class ReportBuilder<C extends Report, B extends ReportBuilder<C, B>>
extends BasicReport.BasicReportBuilder<C, B> {
public C build() {
Objects.requireNonNull(reportType);
Report r = new Report(self());
Objects.requireNonNull(r.getBasicProperty());
return (C)r;
}
// ...