Here you can find the source of getMethod(Class
public static <T> Method getMethod(Class<T> clazz, String methodName)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { public static <T> Method getMethod(Class<T> clazz, String methodName) { Method[] methods = clazz.getDeclaredMethods(); for (Method m : methods) { if (m.getName().equals(methodName)) { return m; }/* w w w .java 2 s. c o m*/ } methods = clazz.getSuperclass().getDeclaredMethods(); for (Method m : methods) { if (m.getName().equals(methodName)) { return m; } } return null; } }