kl0u commented on a change in pull request #10117: [FLINK-14494][docs] Add 
ConfigOption type to the documentation generator
URL: https://github.com/apache/flink/pull/10117#discussion_r344223561
 
 

 ##########
 File path: 
flink-docs/src/main/java/org/apache/flink/docs/configuration/ConfigOptionsDocGenerator.java
 ##########
 @@ -284,10 +293,58 @@ private static String toHtmlString(final 
OptionWithMetaInfo optionWithMetaInfo)
                        "        <tr>\n" +
                        "            <td><h5>" + escapeCharacters(option.key()) 
+ "</h5>" + execModeStringBuilder.toString() + "</td>\n" +
                        "            <td style=\"word-wrap: break-word;\">" + 
escapeCharacters(addWordBreakOpportunities(defaultValue)) + "</td>\n" +
+                       "            <td>" + type + "</td>\n" +
                        "            <td>" + 
formatter.format(option.description()) + "</td>\n" +
                        "        </tr>\n";
        }
 
+       private static Class<?> getClazz(ConfigOption<?> option) {
+               try {
+                       Method getClazzMethod = 
ConfigOption.class.getDeclaredMethod("getClazz");
+                       getClazzMethod.setAccessible(true);
+                       Class clazz = (Class) getClazzMethod.invoke(option);
+                       getClazzMethod.setAccessible(false);
+                       return clazz;
+               } catch (Exception e) {
+                       throw new RuntimeException(e);
+               }
+       }
+
+       private static boolean isList(ConfigOption<?> option) {
+               try {
+                       Method getClazzMethod = 
ConfigOption.class.getDeclaredMethod("isList");
+                       getClazzMethod.setAccessible(true);
+                       boolean isList = (boolean) 
getClazzMethod.invoke(option);
+                       getClazzMethod.setAccessible(false);
+                       return isList;
+               } catch (Exception e) {
+                       throw new RuntimeException(e);
+               }
+       }
+
+       @VisibleForTesting
+       static String typeToHtml(OptionWithMetaInfo optionWithMetaInfo) {
+               ConfigOption<?> option = optionWithMetaInfo.option;
+               Class<?> clazz = getClazz(option);
+
 
 Review comment:
   Do we expect to have a list of enums or of maps (i.e. any level of 
"nesting")? If yes, what do we expect to have as the result for the docs here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to