Tuesday, April 3, 2007

Annotation

Annotation just gives some structured explanation about source code.

ZZ:
Annotations have a much longer history than Java 5. They have been abundantly used in C# to specify meta-data in code. In Java, tools like XDoclet, Apache Commons, MetaClass, qDox, JAM and others have used special tags inside JavaDoc comments as annotations. Runtime annotations could be achieved in somewhat farfetched way by using Marker Interfaces or even implementing dummy methods. In Java 5, such tricks are no longer necessary as Annotations are now part of the core Java Programming Language.
ZZ

1. These explanations could be systematically extracted and processed during run time
This technique could make our run time behavior configurable
Refer to http://technology.amis.nl/blog/?p=1099

2. They could also act like type safe compiler directives. They inform apt( or javac in jdk6) to generate other resources. Hibernate, beehive uses it this way. Web Services in JDK6 also uses this technique.