public boolean isAnnotationPresent(Class javaClass,String property,Class<? extends Annotation> annotationClass){
  Field field;
  try {
    field=javaClass.getDeclaredField(property);
    return field.isAnnotationPresent(annotationClass);
  }
 catch (  NoSuchFieldException e) {
    Class superclass=javaClass.getSuperclass();
    while (superclass != null) {
      try {
        field=superclass.getDeclaredField(property);
        return field.isAnnotationPresent(annotationClass);
      }
 catch (      NoSuchFieldException e1) {
        superclass=superclass.getSuperclass();
      }
    }
    throw new RuntimeException("Property not found: " + property);
  }
}

public boolean isAnnotationPresent ( Class javaClass , String property , Class < ? extends Annotation > annotationClass ) { Field field ; try { field = javaClass . getDeclaredField ( property ) ; return field . isAnnotationPresent ( annotationClass ) ; } catch ( NoSuchFieldException e ) { Class superclass = javaClass . getSuperclass ( ) ; while ( superclass != null ) { try { field = superclass . getDeclaredField ( property ) ; return field . isAnnotationPresent ( annotationClass ) ; } catch ( NoSuchFieldException e1 ) { superclass = superclass . getSuperclass ( ) ; } } throw new RuntimeException ( "Property not found: " + property ) ; } }
determine whether the given annotation is present in the object ' s class or in any of its superclasses .
