Two Laptop Bag*
The moose likes Java in General and the fly likes Processing Custom Annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Processing Custom Annotations" Watch "Processing Custom Annotations" New topic

Processing Custom Annotations

Zak Nixon
Ranch Hand

Joined: Sep 27, 2003
Posts: 126
I am trying to analyze my code to see if
custom annotations are present.
I am currently reading *.class files from a jar file,
and then trying to see if the annotation is present.

I have been running into some problems though.

1. When I am trying to do the following:

But if I do the following (the only way I know to do it
by dynamically reading it from a jar file):

Using the above code, i can not find the annotations.

Any help would be appreciated ?

Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
Disclaimer: I DON'T KNOW. But since this questions has been here for over half a day without and answer, I'll take a poke at it.

Have you tried using forName() to load the class.

That should find the class anywhere on your classpath, even in a JAR file.

Zak Nixon
Ranch Hand

Joined: Sep 27, 2003
Posts: 126
Thanks Ryan for your attempt.

Unfourtunately, that will still not work....

Zak Nixon
Ranch Hand

Joined: Sep 27, 2003
Posts: 126
Actually, after looking at my code,
I was incorrect in other places rather than the code Ryan posted.

It does work, BTW.

I agree. Here's the link:
subject: Processing Custom Annotations
Similar Threads
Can not find the expected secondary table
Annotation Handler in Java
Jboss 5.1 aop not working
ANT : trying not to include jar class files
how to inject a resource using custom annotation