use of org.ballerinalang.util.codegen.AnnAttachmentInfo in project ballerina by ballerina-lang.
the class SwaggerServiceMapper method createTagModel.
/**
* Creates tag swagger definition.
* @param annotationAttributeValue The ballerina annotation attribute value for tag.
* @param swagger The swagger definition which the tags needs to be build on.
*/
private void createTagModel(AnnAttributeValue annotationAttributeValue, Swagger swagger) {
if (null != annotationAttributeValue && annotationAttributeValue.getAttributeValueArray().length > 0) {
List<Tag> tags = new LinkedList<>();
for (AnnAttributeValue tagAttributeValue : annotationAttributeValue.getAttributeValueArray()) {
AnnAttachmentInfo tagAnnotationAttachment = tagAttributeValue.getAnnotationAttachmentValue();
Tag tag = new Tag();
for (AnnAttributeKeyValuePair annAttributeKeyValuePair : tagAnnotationAttachment.getAttributeKeyValuePairs()) {
if ("name".equals(annAttributeKeyValuePair.getAttributeName())) {
tag.setName(annAttributeKeyValuePair.getAttributeValue().getStringValue());
} else if ("description".equals(annAttributeKeyValuePair.getAttributeName())) {
tag.setDescription(annAttributeKeyValuePair.getAttributeValue().getStringValue());
}
}
tags.add(tag);
}
swagger.setTags(tags);
}
}
Aggregations