Here you can find the source of getMethod(Class> clz, String methodName, Class>... parameterTypes)
public static Method getMethod(Class<?> clz, String methodName, Class<?>... parameterTypes)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { public static Method getMethod(Class<?> clz, String methodName, Class<?>... parameterTypes) { try {/*from ww w . j ava 2 s . com*/ Method m = clz.getDeclaredMethod(methodName, parameterTypes); return m; } catch (NoSuchMethodException | SecurityException e) { return getMethodByNameSimple(clz, methodName); } } public static Method getMethodByNameSimple(Class<?> clz, String methodName) { Method[] methods = clz.getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals(methodName)) { return method; } } return null; } }