private static void writeAbstractType()

in log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/generator/SchemaGenerator.java [197:223]


    private static void writeAbstractType(
            final TypeLookup lookup, final AbstractType abstractType, final XMLStreamWriter writer)
            throws XMLStreamException {
        writer.writeStartElement(XSD_NAMESPACE, "group");
        writer.writeAttribute("name", abstractType.getClassName());
        writeDocumentation(abstractType.getDescription(), writer);
        writer.writeStartElement(XSD_NAMESPACE, "choice");

        final Set<String> implementations = abstractType.getImplementations();
        if (abstractType instanceof PluginType) {
            implementations.add(abstractType.getClassName());
        }
        for (final String implementation : implementations) {
            @Nullable final ArtifactSourcedType sourcedType = lookup.get(implementation);
            if (sourcedType != null && sourcedType.type instanceof PluginType) {
                final PluginType pluginType = (PluginType) sourcedType.type;
                for (final String key : getKeyAndAliases(pluginType)) {
                    writer.writeEmptyElement(XSD_NAMESPACE, "element");
                    writer.writeAttribute("name", key);
                    writer.writeAttribute("type", LOG4J_PREFIX + ":" + pluginType.getClassName());
                }
            }
        }

        writer.writeEndElement();
        writer.writeEndElement();
    }