Creating Custom annotations
Looking at the source codes of annotations provided by java 5 (like @Override, @SuppressWarnings etc), shows a simple enough code. However, I suppose there is an Annotation Processing Tool that ships in with the jdk 5 compiler that takes care of the functionality you need to implement with any annotation. But there must be some code that goes behind all these which the APT deciphers and brings out the functionality you want to implement. I am in seek of such codes and how to write them if I want to implement some custom functionality out of my custom annotations.
Runtime-Processing doesn't need APT
the short answer using Reflection:
just for Runtime-Processing you don't need the mentioned APT. You can just go with
provided the given Annotation class uses Runtime-Retention
The longer answer not using Reflection:
In fact there is a pretty compact how-to for both Java 5 and 6 from Sun. java.sun.com/j2se/1.5.0/docs/guide/apt/GettingStarted.html (Sorry but forum-given I am a newbee) But the code is unneccessarryy un-understandable without deeper knowledge of the used (Sun) Mirror-API.
Anyways there is an promising project to simplify the APT-like Annotation compilation: apt-jelly.sourceforge.net (URL: sorry only 2 posts)
I hope that suffices for the first reply.