public static List<Method> findMethods(Class<?> type,
			Class<? extends Annotation> annotation) {
		List<Method> list = new ArrayList<Method>();
		while (type != null) {
			for (Method method : type.getDeclaredMethods()) {
				if (method.getAnnotation(annotation) != null) {
					list.add(method);
				}
			}
			type = type.getSuperclass();
		}
		return list;
	}
public static List < Method > findMethods ( Class < ? > type , Class < ? extends Annotation > annotation ) { List < Method > list = new ArrayList < Method > ( ) ; while ( type != null ) { for ( Method method : type . getDeclaredMethods ( ) ) { if ( method . getAnnotation ( annotation ) != null ) { list . add ( method ) ; } } type = type . getSuperclass ( ) ; } return list ; }
Find the methods in a class (and its ancestors) annotated with a given
annotation.

@param type
the class
@param annotation
the annotation
@return the list of methods. Empty list if none is found.