Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { public static Method getDeclaredMethod(Class<?> clazz, String name, Class<?>... argTypes) { try { final Method method = clazz.getDeclaredMethod(name, argTypes); method.setAccessible(true); return method; } catch (final SecurityException e) { throw new RuntimeException(e); } catch (final NoSuchMethodException e) { return null; } } }