public static Method getMethod(Class clazz, String name, Class[] parameterTypes, boolean acceptNulls) { for (Method method : clazz.getMethods()) { if (method.getName().equals(name)) { if (parameterTypes == null) { return method; } else if (compare(method.getParameterTypes(), parameterTypes, true, acceptNulls)) { return method; } } } return null; }