List of utility methods to do Method from Class
boolean | hasMethod(String clazz, String methodName, Class[] methodTypes) return true if given method exists try { return hasMethod(Class.forName(clazz), methodName, methodTypes); } catch (Exception e) { return false; |
Object | invokePrivateMethod(String methodName, Class[] params, Object[] args, Class containingClass, Object invocationTarget) invoke Private Method try { Method method = containingClass.getDeclaredMethod(methodName, params); method.setAccessible(true); return method.invoke(invocationTarget, args); } catch (Exception e) { throw new RuntimeException(e); |