code: private static Method findMethod(
              Object target,
              String name,
              Class<?> parameterType) {
  
          for (Method method : target.getClass().getMethods()) {
              if (!method.getName().equals(name)) {
                  continue;
              }
  
              Class<?>[] parameters = method.getParameterTypes();
              if (parameters.length != 1) {
                  continue;
              }
  
              if (parameters[0].isAssignableFrom(parameterType)) {
                  return method;
              }
          }
  
          throw new IllegalStateException(
                  "No method '" + name + "(" + parameterType + ") on type "
                  + target.getClass());
      }
docs: Finds a method of the given name that will accept a parameter of the
  given type. If more than one method matches, returns the first such
  method found.
  
  @param target the object to reflect on
  @param name the name of the method to search for
  @param parameterType the type of the parameter to be passed
  @return the matching method
  @throws IllegalStateException if no matching method is found