The current release 3.0 does not provide high-level API.
So you must use the lower-level API, but using it is not difficult.
For example,


  | import javassist.*;
  | import javassist.bytecode.*;
  | 
  | CtMethod m = ... ;
  | MethodInfo minfo = m.getMethodInfo();
  | AnnotationsAttribute attr = (AnnotationsAttribute)
  |     minfo.getAttribute(AnnotationsAttribute.invisibleTag);
  | if (atr != null) {
  |     Annotation an = attr.getAnnotation("Author");
  |     String s = ((StringMemberValue)a.getMemberValue("name")).getValue();
  |     System.out.println("@Author(name=" + s + ")");
  | }
  | 

This prints the @Author annotation of the method m.



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3864611#3864611

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3864611


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to