Java Annotations - Is there any helper library to read/process annotations?

Posted by mjlee on Stack Overflow See other posts from Stack Overflow or by mjlee
Published on 2010-04-07T20:11:19Z Indexed on 2010/04/07 20:13 UTC
Read the original article Hit count: 289

Filed under:
|

I start to use Java annotations heavily. One example is taking method with annotations and converting them into 'telnet'-based command-line command. I do this by parsing annotations and hook into jopt option parser.

However, I do a lot of these manually. For example, Method parameter annotation processing..

Method method = ... //;
Class[] parameters = method.getParamterTypes();
Annotation[][] annotations = method.getparamterAnnotations();

for( int i = 0; i < parameters.length; i++ )
{
   // iterate through the annotation , see if each param has specific annotation ,etc.
}

It is very redundant and tedious.

Is there any opensource project that help processing Annotations?

© Stack Overflow or respective owner

Related posts about java

Related posts about annotations