Search in sources :

Example 1 with Developer

use of org.ballerinalang.ballerina.swagger.convertor.service.model.Developer in project ballerina by ballerina-lang.

the class SwaggerServiceMapper method createDevelopersModel.

/**
 * Creates vendor extension for developers.
 * @param annotationAttributeValue The annotation attribute value for developer vendor extension.
 * @param info The info definition.
 */
private void createDevelopersModel(AnnotationAttachmentAttributeValueNode annotationAttributeValue, Info info) {
    if (null != annotationAttributeValue) {
        List<Developer> developers = new LinkedList<>();
        for (AnnotationAttachmentAttributeValueNode value : annotationAttributeValue.getValueArray()) {
            AnnotationAttachmentNode developerAnnotation = (AnnotationAttachmentNode) value.getValue();
            Map<String, AnnotationAttachmentAttributeValueNode> developerAttributes = this.listToMap(developerAnnotation);
            Developer developer = new Developer();
            if (developerAttributes.containsKey("name")) {
                developer.setName(this.getStringLiteralValue(developerAttributes.get("name")));
            }
            if (developerAttributes.containsKey("email")) {
                developer.setEmail(this.getStringLiteralValue(developerAttributes.get("email")));
            }
            developers.add(developer);
        }
        info.setVendorExtension("x-developers", Lists.reverse(developers));
    }
}
Also used : AnnotationAttachmentAttributeValueNode(org.ballerinalang.model.tree.expressions.AnnotationAttachmentAttributeValueNode) Developer(org.ballerinalang.ballerina.swagger.convertor.service.model.Developer) LinkedList(java.util.LinkedList) AnnotationAttachmentNode(org.ballerinalang.model.tree.AnnotationAttachmentNode)

Aggregations

LinkedList (java.util.LinkedList)1 Developer (org.ballerinalang.ballerina.swagger.convertor.service.model.Developer)1 AnnotationAttachmentNode (org.ballerinalang.model.tree.AnnotationAttachmentNode)1 AnnotationAttachmentAttributeValueNode (org.ballerinalang.model.tree.expressions.AnnotationAttachmentAttributeValueNode)1