Open GoogleCodeExporter opened 8 years ago
Original comment by kube...@gmail.com
on 16 Apr 2011 at 8:20
You are right, this pattern is really nice. It avoids having setters, and
setters are evil :) However, in real life setters are hard to avoid. This
plug-in was created to aid unit testing the contract-first web services with
large DTO structures. Also with the dependency injection frameworks you are
more likely to use setters or factory methods than inner builders.
On the other hand, generating the inner builders on compile time with APT is
very compelling. You'd just have to annotate the classes to generate builders
for. The builders would be generated every time you compile the code, so they'd
never go out of date. Also, the builders could use each other to generate whole
structures of objects.
If you just need a simple inner builders you can use this plug-in:
http://code.google.com/p/bpep/
Currently we are working on abstracting the Java model, in order to have the
implementation based on reflection. Later we'll add an implementation for
javax.lang.model.type classes. That will open a way to implementing the APT
plug-ins. Unfortunately it's a long way to get there.
Original comment by pwyrzy...@gmail.com
on 26 Apr 2011 at 10:09
Original issue reported on code.google.com by
cdore...@gmail.com
on 16 Apr 2011 at 3:24