If you are interested in code generation, model driven architecture or in metaprogramming generally, have a look at Eclipse EMF.
To put it simply, you can create an entire Java GUI application (okay - an Eclipse Plugin) by defining your model in Java classes (or it can import a Rational Rose model or use the Omondo UML plugin for Eclipse).
I found the existing functionality amazing: Following the tutorial it took me 30 minutes to have a fully functioning Eclipse plugin that allowed data editing and persistance to XML. The only code that I needed to write was some interfaces that defined how my data interacted using the JavaBeans model, and everything else was generated.

The crazy thing is that this application generation I’m raving about is really just a sample for the tutorial - developers are supposed to use EMF as a tool to generate code however they like. Anyway, if I was considering writing a XDoclet plugin or something similar right now I would look very hard at using EMF instead.