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
The Annotation Processing Tool(APT) is JDK bundled tool. It's well known, but not standard and not supported commonly. For example, Maven plugin is still alpha version.
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 the most favorite source parser for me. It helps to parse Java and JSP. You don't have to use annotations.
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.
ASM is a library, not a framework. We have to write a product to use automatically like Maven plugin. I think that
openjpa:enhance is one of the most famous example.