code: public Method getMethod(Class<?> clazz, String methodName, Class<?>... typeArgs) {
  		int numParams = typeArgs == null ? 0 : typeArgs.length;
  		Method[] classMethods = clazz.getMethods();
  		for (Method method : classMethods) {
  			if (method.getName().equals(methodName)) {
  				if (method.getParameterTypes().length == numParams) {
  					boolean isCompatible = true;
  					Class<?>[] methodParameterTypes = method.getParameterTypes();
  					for (int i = 0; i < methodParameterTypes.length; i++) {
  						isCompatible = isCompatible(typeArgs[i], methodParameterTypes[i]);
  						if (!isCompatible)
  							break;
  					}
  					if (isCompatible) {
  						return method;
  					}
  				}
  			}
  		}
  		classMethods = clazz.getDeclaredMethods();
  		for (Method method : classMethods) {
  			if (method.getName().equals(methodName)) {
  				if (method.getParameterTypes().length == numParams) {
  					boolean isCompatible = true;
  					Class<?>[] methodParameterTypes = method.getParameterTypes();
  					for (int i = 0; i < methodParameterTypes.length; i++) {
  						isCompatible = isCompatible(typeArgs[i], methodParameterTypes[i]);
  						if (!isCompatible)
  							break;
  					}
  					if (isCompatible) {
  						return method;
  					}
  				}
  			}
  		}
  		Method result = null;
  		if (clazz.isMemberClass()) {
  			result = getMethod(clazz.getEnclosingClass(), methodName, typeArgs);
  		}
  		if (result == null && clazz.getSuperclass() != null) {
  			return getMethod(clazz.getSuperclass(), methodName, typeArgs);
  		}
  		return result;
  	}
docs: This method returns a method(public, protected or private) which appears
  in the selected class or any of its parent (interface or superclass) or
  container classes (when the selected class is an inner class) which
  matches with the name and whose parameters are compatible with the
  selected typeArgs.
  
  @param clazz
  Class to scan
  @param methodName
  Method name
  @param typeArgs
  Method arguments
  @return Method instance