Here you can find the source of getMethod(Class clazz, String methodName, Class argType)
static java.lang.reflect.Method getMethod(Class clazz, String methodName, Class argType)
//package com.java2s; //License from project: Apache License public class Main { static java.lang.reflect.Method getMethod(Class clazz, String methodName, Class argType) { try {//from w ww. j av a2 s .c om return clazz.getMethod(methodName, new Class[] { argType }); } catch (Throwable ex) { } final java.lang.reflect.Method[] ms = clazz.getMethods(); for (java.lang.reflect.Method m : ms) { if (!m.getName().equals(methodName)) continue; // if( m.getModifiers()&Method.PUBLIC Class pramTypes[] = m.getParameterTypes(); if (pramTypes.length == 1 && pramTypes[0].isAssignableFrom(argType)) return m; } return null; } }