in apache-rat-core/src/main/java/org/apache/rat/help/Licenses.java [194:235]
private void printChildren(final int indent, final Object parent, final Map<String, Description> children) throws IOException {
for (Description d : children.values()) {
switch (d.getType()) {
case PARAMETER:
if (d.isCollection()) {
print(indent, format("%s: %n", d.getCommonName()));
try {
Collection<?> result = (Collection<?>) d.getter(parent.getClass()).invoke(parent);
for (Object o : result) {
printObject(indent + 1, o);
}
return;
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
if (IHeaderMatcher.class.isAssignableFrom(d.getChildType())) {
print(indent, format("%s: %n", d.getCommonName()));
// is a matcher.
try {
Object matcher = d.getter(parent.getClass()).invoke(parent);
printObject(indent + 1, matcher);
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
} else {
String txt = StringUtils.defaultIfBlank(d.getParamValue(parent), "").replaceAll("\\s{2,}", " ");
if (!txt.isEmpty() && !(d.getCommonName().equals("id") && isUUID(txt))) {
print(indent, format("%s: %s%n", d.getCommonName(), txt.replaceAll("\\s{2,}", " ")));
}
}
break;
case BUILD_PARAMETER:
case LICENSE:
// do nothing
break;
case MATCHER:
printChildren(indent + 1, parent, d.getChildren());
break;
}
}
}