public static Method findMethod(Class<?> clazz, String method, Class<?>... parameters) {
        for (Method m : clazz.getDeclaredMethods())
            if (m.getName().equals(method) && Arrays.equals(m.getParameterTypes(), parameters))
                return m;
        if (clazz.getSuperclass() != null)
            return findMethod(clazz.getSuperclass(), method, parameters);
        return null;
    }