@NonNull
  public static Object invokeMethod(Object obj, String methodName, Object... params) {
    Method m;
    try {
      m = obj.getClass().getMethod(methodName, getParameterTypes(params));
      m.setAccessible(true);
      return m.invoke(obj, params);
    } catch (NoSuchMethodException e) {
      throw new UnsupportedOperationException("Cannot find specified method " + methodName, e);
    } catch (IllegalAccessException e) {
      throw new UnsupportedOperationException("Unable to access specified method " + methodName, e);
    } catch (IllegalArgumentException e) {
      throw new UnsupportedOperationException("Illegal arguments supplied for method " + methodName,
        e);
    } catch (InvocationTargetException e) {
      throw new UnsupportedOperationException("Method threw an exception for " + methodName, e);
    }
  }
Get and invoke the target method from the given object with given parameters
@param obj        the object to get and invoke method from
@param methodName the name of the method to invoke
@param params     the parameters for the method to invoke
@return the return value of the method invocation
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectionUtils.java