code: public static Object invoke(final Object instance, final String method, final Object... parameters) throws Throwable {
  
          final Class<?> clazz = instance.getClass();
  
          for (final Method m : clazz.getMethods()) {
  
              if (m.getName().equals(method)) {
  
                  try {
                      return m.invoke(instance, parameters);
                  } catch (final IllegalArgumentException | IllegalAccessException e) {
                      throw new RuntimeException("Can't invoke method", e);
                  } catch (final InvocationTargetException e) {
                      throw e.getTargetException();
                  }
              }
          }
          throw new RuntimeException("Can't find method");
      }
docs: Execute a method by reflection.
  
  @param instance
  to inspect
  @param method
  the name of the method to be invoked
  @param parameters
  the instances used to fill the parameters
  @return the result of the method invoked
  @throws Throwable
  in case anything goes wrong