public static boolean isAnnotationPresent ( Class < ? > target , Class < ? extends Annotation > annotation ) { Class < ? > clazz = target ; if ( clazz . isAnnotationPresent ( annotation ) ) { return true ; } while ( ( clazz = clazz . getSuperclass ( ) ) != null ) { if ( clazz . isAnnotationPresent ( annotation ) ) { return true ; } } return false ; }
Returns true if the supplied annotation is present on the target class or any of its super classes .