Here you can find the source of getMethod(Class> clazz, String... names)
public static Method getMethod(Class<?> clazz, String... names)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; public class Main { public static Method getMethod(Class<?> clazz, String... names) { try {/*from w ww . jav a 2 s. co m*/ Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { for (String methodName : names) { if (method.getName().equalsIgnoreCase(methodName)) { method.setAccessible(true); return method; } } } } catch (Exception e) { throw e; } return null; } }