Java Annotations, XDoclet, or Neither?
First, let me explain why I have "Neither" on the subject line. Annotations in Java have been and remain controversial. They are a way to place tags in your Java source code to facilitate the automatic generation of source code artifacts, e.g. XML configurations or other boilerplate Java code. A very common use might be to place annotations in your POJO (plain old Java object) that allow for the automatic generation of Hibernate object-relational mapping (ORM) XML files (i.e. the *.hbm files). Folks in the "Neither" camp argue that annotations clutter the code and that code and configuration ought to reside in separate files. Folks who favor annotations argue that having configuration inline with the code makes it easier to keep track of all aspects of the component -- only one Java file per component -- and reduces mundane work since tools can use brief annotations in the primary Java source file to generate elaborate peripheral artifacts. However, once we're ...