public void generate()

in build-tools/docs-utils/src/main/java/org/apache/spark/k8s/operator/utils/ConfOptionDocGenerator.java [40:72]


  public void generate(String docsPath) throws IOException, IllegalAccessException {
    Field[] fields = SparkOperatorConf.class.getDeclaredFields();
    File docsDir = new File(docsPath);
    if (!docsDir.exists() && docsDir.mkdir()) {
      log.info("Creating docs directory at {}", docsPath);
    }
    File generated = new File(docsPath, CONF_FILE_NAME);
    if (generated.createNewFile()) {
      log.info("Creating props at {}/{}", docsPath, CONF_FILE_NAME);
    }
    PrintWriter printWriter = new PrintWriter(generated, "UTF-8");
    printWriter.println(String.format("[//]: # (%s)", GENERATED_FILE_HEADER));
    printWriter.println("# Spark Operator Config Properties");
    DocTable table =
        DocTable.builder()
            .headers(List.of("Key", "Type", "Default Value", "Allow Hot Reloading", "Description"))
            .columns(5)
            .build();
    for (Field f : fields) {
      if (ConfigOption.class.isAssignableFrom(f.getType())) {
        ConfigOption<?> conf = (ConfigOption<?>) f.get(this);
        table.addRow(
            List.of(
                conf.getKey(),
                conf.getTypeParameterClass().getSimpleName(),
                conf.getDefaultValue().toString(),
                String.valueOf(conf.isEnableDynamicOverride()),
                conf.getDescription()));
      }
    }
    table.flush(printWriter);
    printWriter.close();
  }