[jboss-user] [Javassist user questions] - Re: adding annotations

gkorland do-not-reply at jboss.com
Tue Feb 19 17:10:29 EST 2008


Hi Luca,
Check the AnnotationsAttribute JDoc.

ClassFile cf = ... ;
ConstPool cp = cf.getConstPool();
AnnotationsAttribute attr  = new AnnotationsAttribute(cp, AnnotationsAttribute.visibleTag);

Annotation a = new Annotation("Author", cp);
a.addMemberValue("name", new 

StringMemberValue("Chiba", cp));
attr.setAnnotation(a);
cf.addAttribute(attr);
cf.setVersionToJava5();

Guy

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

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



More information about the jboss-user mailing list