@Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
      String name = method.getName();
      if (Arrays.asList("getAll", "get", "query").contains(name)) {
        calls.add(new MethodCall(method, args));
      }
      return method.invoke(delegate, args);
    }
Simple dynamic proxy to intercept method calls and arguments
criteria/geode/test/org/immutables/criteria/geode/GetAllOptimizationTest.java