@Override
  protected ViewQuery create(Part part, Iterator<Object> objectIterator) {
    ConvertingIterator iterator = new ConvertingIterator(objectIterator, converter);

    switch (part.getType()) {
      case GREATER_THAN_EQUAL:
        startKey(iterator);
        break;
      case LESS_THAN_EQUAL:
        query.inclusiveEnd(true);
      case BEFORE:
      case LESS_THAN: // fall-through on purpose here
        endKey(iterator);
        break;
      case BETWEEN:
        startKey(iterator);
        endKey(iterator);
        break;
      case STARTING_WITH: // starting_with only supports String keys
        String nameStart = nextString(iterator);
        query.startKey(nameStart).endKey(nameStart + "\uefff");
        query.inclusiveEnd(false);
        break;
      case SIMPLE_PROPERTY:
        key(iterator);
        break;
      case IN:
        query.keys(in(iterator));
        break;
      default:
        throw new IllegalArgumentException(
            "Unsupported keyword in View query derivation: " + part.toString());
    }
    return query;
  }
  public ViewQueryCreator(
      PartTree tree,
      ParameterAccessor parameters,
      View viewAnnotation,
      ViewQuery query,
      CouchbaseConverter converter) {
    super(tree, parameters);
    this.query = query;
    this.viewAnnotation = viewAnnotation;
    this.tree = tree;
    this.converter = converter;

    // sanity check the partTree since we have strong restrictions on what's supported:
    int i = 0;
    Set<String> properties = new HashSet<String>();
    for (PartTree.OrPart parts : tree) {
      for (Part part : parts) {
        i++;
        properties.add(part.getProperty().toDotPath());
      }
    }
    this.treeCount = i;
    if (properties.size() > 1) {
      throw new IllegalArgumentException("View-based queries do not support compound keys");
    }
  }
    /*
     * (non-Javadoc)
     * @see org.springframework.data.gemfire.repository.query.Predicate#toString(java.lang.String)
     */
    @Override
    public String toString(String alias) {
      Type type = part.getType();

      return String.format(
          "%s.%s %s",
          alias == null ? QueryBuilder.DEFAULT_ALIAS : alias,
          part.getProperty().toDotPath(),
          toClause(type));
    }