Search in sources :

Example 1 with Organization

use of org.ballerinalang.swagger.code.generator.model.Organization in project ballerina by ballerina-lang.

the class SwaggerServiceMapper method createOrganizationModel.

/**
 * Creates vendor extension for organization.
 * @param annotationAttributeValue The annotation attribute value for organization vendor extension.
 * @param info The info definition.
 */
private void createOrganizationModel(AnnAttributeValue annotationAttributeValue, Info info) {
    if (null != annotationAttributeValue) {
        AnnAttachmentInfo organizationAnnotationAttachment = annotationAttributeValue.getAnnotationAttachmentValue();
        Organization organization = new Organization();
        for (AnnAttributeKeyValuePair annAttributeKeyValuePair : organizationAnnotationAttachment.getAttributeKeyValuePairs()) {
            if ("name".equals(annAttributeKeyValuePair.getAttributeName())) {
                organization.setName(annAttributeKeyValuePair.getAttributeValue().getStringValue());
            } else if ("url".equals(annAttributeKeyValuePair.getAttributeName())) {
                organization.setUrl(annAttributeKeyValuePair.getAttributeValue().getStringValue());
            }
        }
        info.setVendorExtension("x-organization", organization);
    }
}
Also used : AnnAttributeKeyValuePair(org.ballerinalang.util.codegen.AnnAttributeKeyValuePair) AnnAttachmentInfo(org.ballerinalang.util.codegen.AnnAttachmentInfo) Organization(org.ballerinalang.swagger.code.generator.model.Organization)

Aggregations

Organization (org.ballerinalang.swagger.code.generator.model.Organization)1 AnnAttachmentInfo (org.ballerinalang.util.codegen.AnnAttachmentInfo)1 AnnAttributeKeyValuePair (org.ballerinalang.util.codegen.AnnAttributeKeyValuePair)1