in apache-rat-tools/src/main/java/org/apache/rat/tools/MavenGenerator.java [159:189]
private static String getComment(final MavenOption option) {
String desc = option.getDescription();
if (desc == null) {
throw new IllegalStateException(format("Description for %s may not be null", option.getName()));
}
if (!desc.contains(".")) {
throw new IllegalStateException(format("First sentence of description for %s must end with a '.'", option.getName()));
}
String arg;
if (option.hasArg()) {
arg = desc.substring(desc.indexOf(" ") + 1, desc.indexOf(".") + 1);
arg = WordUtils.capitalize(arg.substring(0, 1)) + arg.substring(1);
} else {
arg = "The state";
}
if (option.hasArg() && option.getArgName() != null) {
Supplier<String> sup = OptionCollection.getArgumentTypes().get(option.getArgName());
if (sup == null) {
throw new IllegalStateException(format("Argument type %s must be in OptionCollection.ARGUMENT_TYPES", option.getArgName()));
}
desc = format("%s Argument%s should be %s%s. (See Argument Types for clarification)", desc, option.hasArgs() ? "s" : "",
option.hasArgs() ? "" : "a ", option.getArgName());
}
StringBuilder sb = new StringBuilder()
.append(format(" /**%n * %s%n * @param %s %s%n", StringEscapeUtils.escapeHtml4(desc),
option.getName(), StringEscapeUtils.escapeHtml4(arg)));
if (option.isDeprecated()) {
sb.append(format(" * @deprecated %s%n", StringEscapeUtils.escapeHtml4(option.getDeprecated())));
}
return sb.append(format(" */%n")).toString();
}