Re: Using ASM to read method annotations
Leo Romanoff <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Hi, Thanks for your advice. I fixed my issue based on that. I also found this example rather useful for getting a better understanding: http://grepcode.com/file/repo1.maven.org/maven2/org.mule/mule-core/3.0.0-M3/org/mule/util/scan/annotations/AnnotationsScanner.java -Leo Tronje Krop wrote: > > Hi Leo, > > I cannot say why your solution is not working correctly, but here is how > to do it. > > You first have to create a FieldVisitor/MethodVisitor in your custom class > visitor. If you don't do that, you will not receive any events from the > fields or methods including annotations. The FieldVisitor/MethodVisitor > must create the AnnotationVisitor on request to capture the details. > > The EmptyVisitor should solve this problem by returning itself as Field- > Visitor/MethodVisitor/AnnotationVisitor as it implements all this inter- > faces. If your custom ClassVisitor overrides this mechanism you will fail > to receive the annotation details. > > Best regards, > > Tronje > > Leo Romanoff wrote: >> Hi, >> >> How I can use ASM to read method annotations? I'm able to read class >> annotations by implementing a visitAnnotation method in my custom >> ClassVisitor class derived from the EmptyVisitor. But this method is not >> invoked for method or field annotations. >> >> May be I do not understand how to do a similar thing for the methods or >> fields of the class? Is there any example available? >> >> Thanks, >> Leo >> > > -- > Tronje Krop <[email protected]> > > Encrypted eMail welcome! GPG/PGP-Key: 0x9AD43A05 > 68E5 A3D3 75A0 B096 AC75 62D5 8EEE 3D18 9AD4 3A05 > > No responsibility is taken for the correctness of the > previous information. Please delete if you receive this > mail unintentional. > > > -- > You receive this message as a subscriber of the [email protected] mailing list. > To unsubscribe: mailto:[email protected] > For general help: mailto:[email protected]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- View this message in context: http://old.nabble.com/Using-ASM-to-read-method-annotations-tp30759755p30813690.html Sent from the ASM mailing list archive at Nabble.com.
message-footer.txt
(text/plain, 238 B)
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws