You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a few features that would be nice to add to the generator.
An option to add a static builder() method in the enclosing class. e.g.:
public record RecordA(String fieldOne, String fieldTwo) {
public static RecordABuilder builder() {
return new RecordABuilder();
}
public static final class RecordABuilder {
...
}
}
This would make the creation of the instances read a bit more fluent, e.g.:
RecordA a = RecordA.builder().withFieldOne("").build();
vs.
RecordA a = RecordABuilder.aRecordA().withFieldOne("").build();
A copy constructor for the builder, e.g.:
public record RecordA(String fieldOne, String fieldTwo) {
public static RecordABuilder builder() {
return new RecordABuilder();
}
public static RecordABuilder builder(RecordA recordA) {
return new RecordABuilder(recordA);
}
public static final class RecordABuilder {
private String fieldOne;
private String fieldTwo;
private RecordABuilder() {
}
private RecordABuilder(RecordA recordA) {
this.fieldOne = recordA.fieldOne();
this.fieldTwo = recordA.fieldTwo();
}
...
}
}
There are a few features that would be nice to add to the generator.
This would make the creation of the instances read a bit more fluent, e.g.:
vs.
This would allow writing code like this:
The text was updated successfully, but these errors were encountered: