in log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/DescriptorGenerator.java [504:533]
private PluginAttribute createPluginAttribute(
final Element element,
final ElementImports imports,
final String qualifiedClassName,
final String description,
final String specifiedName) {
final PluginAttribute attribute = new PluginAttribute();
// Name
attribute.setName(specifiedName.isEmpty() ? getAttributeOrPropertyName(element) : specifiedName);
// Type
final TypeMirror type = getMemberType(element);
final String className = getClassName(type);
// If type is not a well-known declared type, add it to the scanning queue.
if (className != null && !KNOWN_SCALAR_TYPES.contains(className) && type instanceof DeclaredType) {
scalarTypesToDocument.add(asTypeElement((DeclaredType) type));
}
attribute.setType(className);
// Description
attribute.setDescription(createDescription(element, imports, qualifiedClassName, description));
// Required
attribute.setRequired(annotations.hasRequiredConstraint(element));
// Default value
final Object defaultValue =
element instanceof VariableElement ? ((VariableElement) element).getConstantValue() : null;
if (defaultValue != null) {
attribute.setDefaultValue(elements.getConstantExpression(defaultValue));
}
// TODO: add the value of the property used, when we add it to the annotation.
return attribute;
}