code: public String build() {
          String fieldsString = this.fields == null ? null : Helpers.quote(this.fields);
          String sortString = this.sort == null ? null : quoteSort(this.sort);
          String limitString = this.limit == null ? null : Helpers.quote(this.limit);
          String skipString = this.skip == null ? null : Helpers.quote(this.skip);
          String bookmarkString = this.bookmark == null ? null : Helpers.quote(this.bookmark);
          String useIndexString = this.useIndex == null ? null : Helpers.quote(this.useIndex);
          StringBuilder builder = new StringBuilder();
          // build up components...
          // selector
          builder.append(Helpers.withKey(Helpers.SELECTOR, this.selector));
          // fields
          if (fieldsString != null) {
              builder.append(String.format(", \"fields\": %s", fieldsString));
          }
          // sort
          if (sortString != null) {
              builder.append(String.format(", \"sort\": %s", sortString));
          }
          // limit
          if (limitString != null) {
              builder.append(String.format(", \"limit\": %s", limitString));
          }
          // skip
          if (skipString != null) {
              builder.append(String.format(", \"skip\": %s", skipString));
          }
          if (bookmarkString != null) {
              builder.append(String.format(", \"bookmark\": %s", bookmarkString));
          }
          if (!this.update) {
              builder.append(", \"update\": false");
          }
          if (this.stable) {
              builder.append(", \"stable\": true");
          }
          // execution_stats
          if (this.executionStats) {
              builder.append(", \"execution_stats\": true");
          }
          if (useIndexString != null) {
              builder.append(String.format(", \"use_index\": %s", useIndexString));
          }
          return String.format("{%s}", builder.toString());
      }
docs: Build string representation of query for use with
  {@link com.cloudant.client.api.Database#query(String, Class)}.
  @return String representation of query.