Yet another builder generator. Primary style of this generator will be fluent wither, although other styles will be supported in the future. There is support for builder chaining.
Apache License 2.0
2
stars
2
forks
source link
SeeAlso method generated while previously skipped #32
Given the following situation the resulting code does not compile because of overlap between own and inherited methods.
@SeeAlso( ExtendedField.class )
@Builder
class Field {
// fields
}
@Builder
class ExtendedField extends Field {
// fields
}
@Builder
class Parent {
List<Field> fields;
}
@Builder
class Child extends Parent {
List<ExtendedField> extendedField;
}
currently generated code:
class ChildBuilder {
List<FieldBuilder> fieldsBuilders = new ArrayList<>(); // the collection of Parent
List<ExtendedFieldBuilder> extendedFieldBuilders = new ArrayList<>(); // the collection of Child
FieldBuilder<ChildBuilder<PARENT>> addFields() {
FieldBuilder<ChildBuilder<PARENT>> builder = new FieldBuilder(this);
fieldsBuilders.add(builder); // add to the collection of Parent
return builder;
}
ExtendedFieldBuilder<ChildBuilder<PARENT>> addExtendedField() {
ExtendedFieldBuilder<ChildBuilder<PARENT>> builder = new ExtendedFieldBuilder(this);
fieldsBuilders.add(builder); // add to the collection of Parent
return builder;
}
// the following method was not generated for 0.1.0, but is in the 0.1.1-SNAPSHOT
ExtendedFieldBuilder<ChildBuilder<PARENT>> addExtendedField() {
ExtendedFieldBuilder<ChildBuilder<PARENT>> builder = new ExtendedFieldBuilder(this);
extendedFieldBuilders.add(builder); // add to the collection of Child
return builder;
}
}
Given the following situation the resulting code does not compile because of overlap between own and inherited methods.
currently generated code: