Here you can find the source of getMethods(Class> clazz, Class extends Annotation> annotation)
public static Method[] getMethods(Class<?> clazz, Class<? extends Annotation> annotation)
//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 Method[] getMethods(Class<?> clazz, Class<? extends Annotation> annotation) { List<Method> methods = new ArrayList(); for (Method m : clazz.getMethods()) { if (m.isAnnotationPresent(annotation)) { methods.add(m);//from w w w .jav a 2 s. com } } return methods.toArray(new Method[0]); } }