Here you can find the source of getMethods(final Class> t, final Class extends Annotation> a)
public static final List<Method> getMethods(final Class<?> t, final Class<? extends Annotation> a)
//package com.java2s; //License from project: Open Source License import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; public class Main { public static final List<Method> getMethods(final Class<?> t, final Class<? extends Annotation> a) { final List<Method> ms = new ArrayList<Method>(); Class<?> c = t;/* w ww . ja va 2s.c o m*/ while (c != null && c != Object.class) { for (final Method m : c.getDeclaredMethods()) if (m.isAnnotationPresent(a)) { m.setAccessible(true); ms.add(m); } c = c.getSuperclass(); } return ms; } }