There are many way to generate code automatically. I think that the most common way is Annotation Processing Tool and Pluggable Annotation Processing API, but always I use PMD or ASM because I'm familiar with these libraries.
Annotation Processing Tool
Pluggable Annotation Processing API
The most standard & recent way to generate code automatic. I'm not sure so I want to learn -- it looks easy.
- http://itpro.nikkeibp.co.jp/article/COLUMN/20081219/321816/ (Japanese)
- http://d.hatena.ne.jp/t_yano/20111207/1323277622 (Japanese)
PMD is a library, not a framework. We have to write a product to use automatically like Maven plugin. Maven plugin make it easy to give properties, search target file recursive, and unite with build system.
ASM is the most favorite bytecode library for me. It helps to parse & generate class file.