Here you can find the source of getMethod(Class aObject, String aMethod, Class>... aParameterTypes)
public static Method getMethod(Class aObject, String aMethod, Class<?>... aParameterTypes)
//package com.java2s; //License from project: LGPL import java.lang.reflect.Method; public class Main { public static Method getMethod(Class aObject, String aMethod, Class<?>... aParameterTypes) { Method rMethod = null;//w ww .j av a 2 s . c om try { rMethod = aObject.getMethod(aMethod, aParameterTypes); rMethod.setAccessible(true); } catch (Throwable e) {/*Do nothing*/ } return rMethod; } public static Method getMethod(Object aObject, String aMethod, Class<?>... aParameterTypes) { Method rMethod = null; try { rMethod = aObject.getClass() .getMethod(aMethod, aParameterTypes); rMethod.setAccessible(true); } catch (Throwable e) {/*Do nothing*/ } return rMethod; } }