private static void printConfig(Class configClass) throws IllegalAccessException, InstantiationException { Field[] fields = configClass.getDeclaredFields(); System.out.println(); System.out.println("### " + configClass.getSimpleName()); System.out.println(); Object defaultConfig = configClass.newInstance(); System.out.println("|Name|Default|Description|"); System.out.println("|---|---|---|"); try { for (Field field : fields) { field.setAccessible(true); StringBuilder sb = new StringBuilder(); sb.append("|"); Parameter param = field.getDeclaredAnnotation(Parameter.class); if (param != null) { String names = Stream.of(param.names()) .collect(Collectors.joining(", ")); // name sb.append(names).append("|"); // default sb.append(param.required() ? "**required**" : field.get(defaultConfig) + " ").append("|"); // description sb.append(param.description()).append("|"); System.out.println(sb.toString()); } ParametersDelegate delegate = field.getDeclaredAnnotation(ParametersDelegate.class); if (delegate != null) { printConfig(field.getType()); } } } catch (IllegalAccessException e) { e.printStackTrace(); } }