in apache-rat-core/src/main/java/org/apache/rat/config/parameters/DescriptionBuilder.java [81:115]
static List<Description> getConfigComponents(final Class<?> clazz) {
if (clazz == null || clazz == String.class || clazz == Object.class) {
return Collections.emptyList();
}
List<Description> result = new ArrayList<>();
for (Field field : clazz.getDeclaredFields()) {
ConfigComponent configComponent = field.getAnnotation(ConfigComponent.class);
if (configComponent != null) {
String name = StringUtils.isBlank(configComponent.name()) ? field.getName() : configComponent.name();
Class<?> childClazz = configComponent.parameterType() == void.class ? field.getType()
: configComponent.parameterType();
boolean isCollection = Iterable.class.isAssignableFrom(field.getType());
Description desc = new Description(configComponent.type(), name, configComponent.desc(), isCollection,
childClazz, getConfigComponents(childClazz), configComponent.required());
result.add(desc);
}
}
for (Method method : clazz.getDeclaredMethods()) {
ConfigComponent configComponent = method.getAnnotation(ConfigComponent.class);
if (configComponent != null) {
String name = StringUtils.isBlank(configComponent.name()) ? fixupMethodName(method) : configComponent.name();
Class<?> childClazz = configComponent.parameterType() == void.class ? method.getReturnType()
: configComponent.parameterType();
boolean isCollection = Iterable.class.isAssignableFrom(method.getReturnType());
Description desc = new Description(configComponent.type(), name, configComponent.desc(), isCollection,
childClazz, getConfigComponents(childClazz), configComponent.required());
result.add(desc);
}
}
result.addAll(getConfigComponents(clazz.getSuperclass()));
Arrays.stream(clazz.getInterfaces()).forEach(c -> result.addAll(getConfigComponents(c)));
return result;
}