/**
   * 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);
     }
   }
 }
  private void visit(IMethodModel m, String path) {
    boolean hasPath = m.hasAnnotation(PATH);
    if (hasPath) {
      String localPath = m.getAnnotationValue(PATH);
      if (path.endsWith("/")) { // $NON-NLS-1$
        if (localPath.startsWith("/")) { // $NON-NLS-1$
          localPath = localPath.substring(1);
        }
      }

      path += localPath;
    }

    boolean isWs = hasPath;
    for (ActionType q : ActionType.values()) {
      boolean hasAnnotation = m.hasAnnotation(q.name());
      isWs |= hasAnnotation;
    }
    if (isWs) {
      Resource res = new Resource();
      IDocInfo documentation = m.getBasicDocInfo();
      String text = documentation.getDocumentation();
      if (!"".equals(text)) { // $NON-NLS-1$
        res.setDescription(text);
      }
      String returnName = null;
      String parameterName = null;

      ITypeModel returnedType = m.getReturnedType();

      if (returnedType != null) {
        if (returnedType.hasAnnotation(XML_ROOT_ELEMENT)) {
          generateXMLSchema(returnedType);
          returnName = returnedType.getName().toLowerCase();
        }
        if (hasPath) {
          if (consumedTypes.add(returnedType)) {
            ResourceVisitor resourceVisitor = createResourceVisitor();
            resourceVisitor.consumedTypes.addAll(this.consumedTypes);
            resourceVisitor.basePath = path;
            resourceVisitor.spec = this.spec;
            resourceVisitor.visit(returnedType);
          }
        }
      }
      ITypeModel bodyType = m.getBodyType();
      if (bodyType != null) {
        if (bodyType.hasAnnotation(XML_ROOT_ELEMENT)) {
          generateXMLSchema(bodyType);
          parameterName = bodyType.getName().toLowerCase();
        }
      }
      if (path.endsWith("/")) { // $NON-NLS-1$
        res.setRelativeUri(path.substring(0, path.length() - 1));
      } else {
        res.setRelativeUri(path);
      }
      for (ActionType q : ActionType.values()) {
        boolean hasAnnotation = m.hasAnnotation(q.name());
        if (hasAnnotation) {
          addMethod(q, res, m, documentation, returnName, parameterName);
        }
      }
      spec.addResource(res);
    }
  }