Search in sources :

Example 1 with Tags

use of org.apache.nifi.annotation.documentation.Tags in project nifi by apache.

the class HtmlDocumentationWriter method writeTags.

private void writeTags(final ConfigurableComponent configurableComponent, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
    final Tags tags = configurableComponent.getClass().getAnnotation(Tags.class);
    xmlStreamWriter.writeStartElement("h3");
    xmlStreamWriter.writeCharacters("Tags: ");
    xmlStreamWriter.writeEndElement();
    xmlStreamWriter.writeStartElement("p");
    if (tags != null) {
        final String tagString = join(tags.value(), ", ");
        xmlStreamWriter.writeCharacters(tagString);
    } else {
        xmlStreamWriter.writeCharacters("No tags provided.");
    }
    xmlStreamWriter.writeEndElement();
}
Also used : Tags(org.apache.nifi.annotation.documentation.Tags)

Example 2 with Tags

use of org.apache.nifi.annotation.documentation.Tags in project nifi by apache.

the class DtoFactory method getTags.

/**
 * Gets the tags from the specified class.
 */
private Set<String> getTags(final Class<?> cls) {
    final Set<String> tags = new HashSet<>();
    final Tags tagsAnnotation = cls.getAnnotation(Tags.class);
    if (tagsAnnotation != null) {
        for (final String tag : tagsAnnotation.value()) {
            tags.add(tag);
        }
    }
    if (cls.isAnnotationPresent(Restricted.class)) {
        tags.add("restricted");
    }
    return tags;
}
Also used : Tags(org.apache.nifi.annotation.documentation.Tags) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Aggregations

Tags (org.apache.nifi.annotation.documentation.Tags)2 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1