As strange as it sounds, I think that what is really needed in this type
of layered architecture is yet another mapping framework. (And by
"needed", I really mean what would be nice.)
In a sense, your "Assembler" classes are exactly that framework. One
could envision creating an XML mapping based framework that would
"automate" the assembly process, possibly even directly generating the
DTO classes. If using reflection, CGLIB could also be employed in this
layer for performance gains.
If you are an XDoclet fan, it would also be realistic to develop a set
of XDoclet tags that could generate your DTOs right from your domain
objects (similar to the value object tags for EJBs).
Obviously this is a lot of plumbing, but that tends to be the price of
layered architectures. |