Java examples for java.lang.annotation:Class Annotation
Check if class has Annotation
//package com.java2s; import java.lang.annotation.Annotation; import java.lang.reflect.Method; public class Main { public static boolean hasAnnotation(Method method, Class<? extends Annotation> annotation) { return method != null && method.isAnnotationPresent(annotation); }//from ww w .ja va 2s . c o m public static boolean hasAnnotation(Class<?> clazz, Class<? extends Annotation> annotation) { return clazz != null && clazz.isAnnotationPresent(annotation); } }