Object (@NotNull Object obj, @NotNull String methodName, Object... args) { try { Method method = obj.getClass().getMethod(methodName); method.setAccessible(true); return method.invoke(obj, args); } catch (NoSuchMethodException e) { return null; } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof RuntimeException) { throw (RuntimeException) targetException; } throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }