default Optional<Object> replace() {
      Optional<Path> found = values().keySet().stream().map(Visitors::toPath).filter(Path::isRoot).findAny();
      // check that there is just a replace value. no others (like attribute set)
      found.ifPresent(p -> {
        if (values().size() != 1) {
          throw new IllegalArgumentException(String.format("Expected exactly one value for replacement got %d: %s", values().size(), values().keySet()));
        }
      });
      return found.map(p -> values().get(p));
    }
If current operation is replace, return replacement, otherwise return empty optional.
Replace means override whole record / document not a subset of attributes.
criteria/common/src/org/immutables/criteria/backend/StandardOperations.java