简体   繁体   中英

Identify annotation class in java

I have a utility that scans different classes in the classpath, and checks for unused classes.

Some classes need special treatment, like interfaces and abstract classes. Those can be easily identified using reflection. The problem arises when trying to identify a class that is an annotation class (ie @interface). Is it possible to know if a class is really an annotation?

Yeah.. It's possible to know if a class is really an annotation. Please try this:

http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#isAnnotation%28%29

http://java.dzone.com/articles/discovering-java-annotations

It may help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM