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

Entities of same name present in subpackages are ignored #32

Open krishnapuranika opened 9 years ago

krishnapuranika commented 9 years ago

Builder generator doesn't respect relative subpackage structure of the src model when generating builders. This can cause problems when buildergenerator encounters entities of the same name but in different subpackages.

Thanks.

uglycustard commented 9 years ago

This presents an interesting challenge as any classes with the same name will result in builders with the same name being written into the same package. The problem (I think) is that both builders are being generated but one is overwriting the other.

I think there are a few solutions to this problem:

  1. provide capability to specify a custom name for the builder of a target class
  2. provide capability to specify a specific package for the builder of a target class
  3. provide capability to configure BG to write individual builders into same package as target class

... and probably many others.

What do you think?

uglycustard commented 8 years ago

As a workaround, BG can be configured to ignore one of the properties causing this multiple generation, then generate again from that node in the object graph but into a different package.