code: public static Method findAnnotatedGetter(Class<?> cls, Class<? extends Annotation> class1) {
          for (final Method m : cls.getDeclaredMethods()) {
              if (m.getAnnotation( class1 ) != null) {
                  if (!m.getReturnType().equals( Void.TYPE ) && !Modifier.isAbstract( m.getModifiers() )
                          && (m.getParameterTypes().length == 0)
                          // must be public
                          && (Modifier.isPublic( m.getModifiers() ))) {
                      return m;
                  }
              }
          }
          return null;
      }
docs: Find a getter with the specified annotation. getter must be annotated,
  return a value, not be abstract and not take any parameters and is
  public.
  
  @param cls
  Class that declares the method to find.
  @param class1
  the annotation to find.
  @return getter method or null