in apache-rat-core/src/main/java/org/apache/rat/help/Licenses.java [98:152]
public void output() throws IOException {
print(0, header("LICENSES"));
if (licenses.isEmpty()) {
print(0, "No licenses defined");
} else {
Description licenseDescription = DescriptionBuilder.build(licenses.first());
Collection<Description> licenseParams = licenseDescription.filterChildren(d -> d.getType() == ComponentType.PARAMETER);
print(0, format("Licenses have the following properties:%n"));
for (Description param : licenseParams) {
print(1, format("%s: %s%n", param.getCommonName(), param.getDescription()));
}
print(0, format("%nThe defined licenses are:%n"));
for (ILicense l : licenses) {
print(0, System.lineSeparator());
printObject(0, l);
}
}
print(0, header("DEFINED MATCHERS"));
SortedSet<Description> matchers = new TreeSet<>(Comparator.comparing(Description::getCommonName));
for (Class<? extends AbstractBuilder> mClazz : MatcherBuilderTracker.instance().getClasses()) {
try {
AbstractBuilder builder = mClazz.getConstructor().newInstance();
matchers.add(builder.getDescription());
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException e) {
throw new ConfigurationException(
format("Can not instantiate matcher builder %s ", mClazz.getName()), e);
}
}
for (Description description : matchers) {
print(0, format("%n%s: %s%n", description.getCommonName(), description.getDescription()));
for (Description child : description.getChildren().values()) {
if (IHeaderMatcher.class.isAssignableFrom(child.getChildType())) {
if (child.isCollection()) {
print(2, "Encloses multiple matchers");
} else {
print(2, "Wraps a single matcher");
}
} else {
print(1, format("%s: %s%s", child.getCommonName(), child.isRequired() ? "(required) " : "", child.getDescription()));
}
}
}
print(0, header("DEFINED FAMILIES"));
for (ILicenseFamily family : config.getLicenseFamilies(LicenseFilter.ALL)) {
print(1, format("%s - %s%n", family.getFamilyCategory(), family.getFamilyName()));
}
printWriter.flush();
}