Here you can find the source of getMethod(Class> clazz, String name, boolean declared, Class>... args)
public static Method getMethod(Class<?> clazz, String name, boolean declared, Class<?>... args)
//package com.java2s; //License from project: LGPL import java.lang.reflect.Method; public class Main { public static Method getMethod(Class<?> clazz, String name, boolean declared, Class<?>... args) { try {/*w ww . j a v a 2 s .co m*/ Method method = null; if (declared) { method = clazz.getDeclaredMethod(name, args); method.setAccessible(true); } else method = clazz.getMethod(name, args); return method; } catch (Throwable error) { return null; } } }