Open i-zanis-simply opened 1 year ago
I would also like to see something like this on the target class. I usually create two builder methods on my target class, a toBuilder(this)
and a static builder()
method. It makes it convenient to create builders quickly with context.
Example:
public class TargetClass {
private double value;
private Targetclass(double value){
this.value = value;
}
public static InnerBuilder builder(){
return new InnerBuilder();
}
public InnerBuilder toBuilder(){
return new InnerBuilder(this);
}
//----------------------
public static final class InnerBuilder {
private double value;
private InnerBuilder() {
}
private InnerBuilder(TargetClass other) {
this.value= other.val;ue;
}
public InnerBuilder value(double value) {
this.value = value;
return this;
}
public InnerBuilder build(){
return new TargetClass(value);
}
}
}
I just discovered this plugin (it's great, thanks!) and immediately I missed these two methods being generated ffor inner class builders. Would be even better if the builder would not generate the public static
aInner() {...}` method. Like the example from @mfunaro above that already did not include it.
Would it be possible to add a toBuilder() method?