private IDocInfo getDocumentation(IMethodModel m) {

    final IDocInfo basicDocInfo = m.getBasicDocInfo();

    String docString = basicDocInfo.getDocumentation();

    if (docString != null && !docString.trim().isEmpty()) {
      return basicDocInfo;
    }

    IAnnotationModel apiOperation = m.getAnnotation(API_OPERATION);
    if (apiOperation != null) {
      StringBuilder bld = new StringBuilder();

      String summary = apiOperation.getValue("value");
      if (summary != null) {
        bld.append(summary.trim());
      }

      String notes = apiOperation.getValue("notes");
      if (notes != null) {
        if (bld.length() != 0) {
          bld.append("\r\n");
        }
        bld.append(notes);
      }
      docString = bld.toString();
    }

    if (docString != null && !docString.isEmpty()) {
      final String finalDocumentation = docString;
      return new IDocInfo() {

        @Override
        public String getReturnInfo() {
          return basicDocInfo.getReturnInfo();
        }

        @Override
        public String getDocumentation(String pName) {
          return basicDocInfo.getDocumentation(pName);
        }

        @Override
        public String getDocumentation() {
          return finalDocumentation;
        }
      };
    }
    return basicDocInfo;
  }
  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);
    }
  }