docs: @SuppressWarnings("unchecked")
      private List<DBParameter> parametersToIndexRevision(DocumentRevision rev,
                                                                       String indexName,
                                                                       List<FieldSort> fieldNames) {
          Misc.checkNotNull(rev, "rev");
          Misc.checkNotNull(indexName, "indexName");
          Misc.checkNotNull(fieldNames, "fieldNames");
  
          int arrayCount = 0;
          String arrayFieldName = null; // only record the last, as error if more than one
          for (FieldSort fieldName : fieldNames) {
              Object value = ValueExtractor.extractValueForFieldName(fieldName.field, rev.getBody());
              if (value != null && value instanceof List) {
                  arrayCount = arrayCount + 1;
                  arrayFieldName = fieldName.field;
              }
          }
  
          if (arrayCount > 1) {
              String msg = String.format("Indexing %s in index %s includes > 1 array field; " +
                              "Only one array field per index allowed.",
                      rev.getId(),
                      indexName);
              logger.log(Level.SEVERE, msg);
              return null;
          }
  
          List<DBParameter> parameters = new ArrayList<DBParameter>();
          List<Object> arrayFieldValues = null;
          if (arrayCount == 1) {
              arrayFieldValues = (List) ValueExtractor.extractValueForFieldName(arrayFieldName,
                      rev.getBody());
          }
  
          if (arrayFieldValues != null && arrayFieldValues.size() > 0) {
              for (Object value : arrayFieldValues) {
                  // For each value in the list we create a row. We put this value at the start
                  // of the INSERT statement along with _id and _rev, followed by the other
                  // fields. _id and _rev are special fields in that they don't appear in the
                  // body, so they need special-casing to get the values.
                  List<FieldSort> initialIncludedFields = Arrays.asList(new FieldSort("_id"),
                          new FieldSort("_rev"),
                          new FieldSort(arrayFieldName));
                  List<Object> initialArgs = Arrays.asList(rev.getId(), rev.getRevision(), value);
                  DBParameter parameter = populateDBParameter(fieldNames,
                          initialIncludedFields,
                          initialArgs,
                          indexName,
                          rev);
                  parameters.add(parameter);
              }
          } else {
              // We know that there is no populated list in the values that we are indexing.
              // We just need to index the fields in the index now. _id and _rev are special
              // fields because they don't appear in the document body, so they need
              // special-casing to get the values.
              List<FieldSort> initialIncludedFields = Arrays.asList(new FieldSort("_id"), new FieldSort("_rev"));
              List<Object> initialArgs = Arrays.<Object>asList(rev.getId(), rev.getRevision());
              DBParameter parameter = populateDBParameter(fieldNames,
                      initialIncludedFields,
                      initialArgs,
                      indexName,
                      rev);
              parameters.add(parameter);
          }
  
          return parameters;
      }