code: public static StringBuilder collectorConfigString(@NonNull String name, @NonNull CollectorBuilder builder) {
          StringBuilder buf = new StringBuilder()
                  .append("collect ")
                  .append(name);
  
          /*
           * Handle main argument.
           */
          if (builder instanceof MainNone) {
              /* SKIP */
          }
          if (builder instanceof MainString) {
              buf
                      .append(' ')
                      .append(quotedString(((MainString)builder).getMain()).toString());
          }
          if (builder instanceof MainStringList) {
              buf
                      .append(' ')
                      .append(((MainStringList)builder).getMain().stream()
                              .map(ConfigSupport::quotedString)
                              .collect(Collectors.joining(", ")));
          }
  
          /*
           * Hande asPath argument.
           */
          if (builder instanceof AcceptAsPath) {
              buf
                      .append(" as ")
                      .append(((AcceptAsPath)builder).getAsPath().configString());
          }
          if (builder instanceof AcceptOptAsPath) {
              ((AcceptOptAsPath)builder).getAsPath()
                      .ifPresent(path -> {
                          buf
                                  .append(" as ")
                                  .append(path.configString());
                      });
          }
  
          /*
           * Handle tag set.
           * If the collector has no tag set, the collector is closed using a semi-colon.
           */
          if (builder instanceof AcceptTagSet) {
              final NameBoundResolver tagSet = ((AcceptTagSet)builder).getTagSet();
              if (tagSet.isEmpty()) {
                  buf.append(';');  // Empty tag set has no meaningful config string.
              } else {
                  buf
                          .append(' ')
                          .append(tagSet.configString());
              }
          } else {
              buf.append(';');
          }
  
          return buf;
      }
docs: Create a config string for a builder.
  
  The function may fail if the builder has not been fully initialized.
  @param name The name of the collector.
  @param builder The builder implementation used to create collectors.
  @return A string with the collect statement.
  The statement will be closed (either with a tag set or a semi-colon).
  The string will not have a trailing new-line.