@Override
    public T invoke(Object... args) {
      VarArgsFunc method = null;
      try {
        method = lookupVisitFunc(args[0]);
        final Object o = method.apply(visitor, args[0], args[1], args[2]);
        return returnClazz.cast(o);
      } catch (Throwable e) {
        throw new RuntimeException("While invoking method " +
            (method != null ? "'" + method + "'" : ""),
            e);
      }
    }
Creates a dispatcher for calls to {@link VisitDispatcher#lookupVisitFunc}. The
dispatcher caches methods between invocations and it is thread-safe.

@param visitorBaseClazz Visitor base class
@param visiteeBaseClazz Visitee base class
@return cache of methods
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveReflectUtil.java