Immutable classes has its fields declared as final which makes the current build method less helpful,
Suggest generating/updating constructor along with builder and do field assignment there
Sample generated code
public class Book {
private final String name;
private final Long costInCents;
private final Optional<String> ISBN10;
public Book(Builder builder) {
this.name = builder.name;
this.costInCents = builder.costInCents;
this.ISBN10 = builder.ISBN10;
}
public static final class Builder {
// Snip code for brevity
public Book build() {
return new Book(this);
}
}
}
Immutable classes has its fields declared as final which makes the current build method less helpful,
Suggest generating/updating constructor along with builder and do field assignment there
Sample generated code