/** * visit. * * @param t a {@link com.mulesoft.jaxrs.raml.annotation.model.ITypeModel} object. */ public void visit(ITypeModel t) { consumedTypes.add(t); IAnnotationModel apiAnn = t.getAnnotation("Api"); if (apiAnn != null) { String baseUri = apiAnn.getValue("basePath"); if (baseUri != null && !baseUri.trim().isEmpty()) { spec.getCoreRaml().setBaseUri(baseUri); } String description = apiAnn.getValue("description"); if (description != null && !description.trim().isEmpty()) { DocumentationItem di = new DocumentationItem(); di.setContent(description); di.setTitle("description"); spec.getCoreRaml().setDocumentation(new ArrayList<DocumentationItem>(Arrays.asList(di))); } String producesString = apiAnn.getValue(PRODUCES.toLowerCase()); if (producesString != null && !producesString.isEmpty()) { classProduces = producesString.split(","); for (int i = 0; i < classProduces.length; i++) { classProduces[i] = classProduces[i].trim(); } } String consumesString = apiAnn.getValue(CONSUMES.toLowerCase()); if (consumesString != null && !consumesString.isEmpty()) { classConsumes = consumesString.split(","); for (int i = 0; i < classConsumes.length; i++) { classConsumes[i] = classConsumes[i].trim(); } } } if (classConsumes == null || classConsumes.length == 0) { classConsumes = t.getAnnotationValues(CONSUMES); } if (classProduces == null || classProduces.length == 0) { classProduces = t.getAnnotationValues(PRODUCES); } String annotationValue = t.getAnnotationValue(PATH); if (basePath != null) { if (annotationValue == null) { annotationValue = ""; // $NON-NLS-1$ } annotationValue = basePath + annotationValue; } if (annotationValue != null) { if (!annotationValue.endsWith("/")) { // $NON-NLS-1$ annotationValue = annotationValue + "/"; // $NON-NLS-1$ } IMethodModel[] methods = t.getMethods(); for (IMethodModel m : methods) { visit(m, annotationValue); } } }
public void visit(ITypeModel t) { consumedTypes.add(t); classConsumes = t.getAnnotationValues(CONSUMES); classProduces = t.getAnnotationValues(PRODUCES); String annotationValue = t.getAnnotationValue(PATH); if (basePath != null) { if (annotationValue == null) { annotationValue = ""; // $NON-NLS-1$ } annotationValue = basePath + annotationValue; } if (annotationValue != null) { if (!annotationValue.endsWith("/")) { // $NON-NLS-1$ annotationValue = annotationValue + "/"; // $NON-NLS-1$ } IMethodModel[] methods = t.getMethods(); for (IMethodModel m : methods) { visit(m, annotationValue); } } }