// This is a bit rough... finds static and non-static methods. static Method findMethodNamed(O obj, String method) { if (obj == null) ret null; if (obj instanceof Class) ret findMethodNamed((Class) obj, method); ret findMethodNamed(obj.getClass(), method); } static Method findMethodNamed(Class c, String method) { while (c != null) { for (Method m : c.getDeclaredMethods()) if (m.getName().equals(method)) { makeAccessible(m); ret m; } c = c.getSuperclass(); } ret null; }