uglycustard / buildergenerator

A tool to auto generate builders following the Builder pattern for an object graph of JavaBeans.
Apache License 2.0
5 stars 2 forks source link

Ignore abstract classes #23

Open uglycustard opened 9 years ago

uglycustard commented 9 years ago

BG is generating builder for abstract class which doesn't compile as it cannot be constructed without specifying a class body.

uglycustard commented 8 years ago

E.g.:

ClassOne {
  ClassTwo propClassTwo
}

ClassTwo (abstract) {
  ClassThree propClassThree
}

ClassThree {
  String prop
}

Possible solutions:

ClassOneBuilder
  withPropClassTwo(Builder<ClassTwo> propClassTwo)

ClassThreeBuilder
  withProp(String prop)

i.e. still traverse the properties of the abstract class for other classes that a builder could be generated for, but don't generate a builder for the abstract class?

or

generate a builder for the abstract class, but make it abstract also with an abstract method that returns an instance of the target class - therefore any non-abstract properties on that abstract class can have a with method generated in the abstract builder allowing sub classes to supply the implementation.