how to juge a class is an annotation,
- How do you know if a class is an annotation
Is there a good Samaritan out there,,,,,,, how to juge a class is an annotation
how to juge a class is an annotation,
Is there a good Samaritan out there,,,,,,, how to juge a class is an annotation
If you have the source code: an annotation is declard as
@interface MyAnnotation { /* ... */ }
If you have some class object:
// Class<?> myClass = MyAnnotation.class;
if (myClass.isAnnotation()) { /* ... */ }
Maybe you can like this:
if(class.hasMethodAnnotation(Annotation.class)){}
Maybe you can do like this;
if (MyExampleClass.class.isAnnotationPresent(MyExampleAnnotation.class)) {
}