Exemple #1
0
  /**
   * Adds a syntax to the syntaxsection
   *
   * @param doc, doc item that has to be add to the syntax section
   */
  void addSyntax(Doc doc) {
    if (doc.isConstructor() || doc.isMethod()) {
      StringBuffer syntaxBuffer = new StringBuffer();
      for (Parameter parameter : ((ExecutableMemberDoc) doc).parameters()) {
        syntaxBuffer.append(parameter.typeName() + " " + parameter.name());
        syntaxBuffer.append(", ");
      }
      if (syntaxBuffer.length() > 2) {
        syntaxBuffer.delete(syntaxBuffer.length() - 2, syntaxBuffer.length());
      }

      String returnType = "";

      if (doc.isMethod()) {
        MethodDoc methodDoc = (MethodDoc) doc;
        returnType = methodDoc.returnType().toString();
        int lastDot = returnType.lastIndexOf('.');
        if (lastDot != -1) {
          returnType = returnType.substring(lastDot + 1);
        }
        returnType += " ";
      }

      if (doc.isConstructor()) {
        addSyntax("<em>" + doc.commentText() + "</em>");
      }

      addSyntax(returnType + doc.name() + "(" + syntaxBuffer.toString() + ")");
    } else if (doc.isField()) {
      FieldDoc fieldDoc = (FieldDoc) doc;
      addSyntax(fieldDoc.type().typeName() + " " + doc.name());
    }
  }
Exemple #2
0
  /**
   * Build the filename for a doc object and returns it
   *
   * @param doc
   * @param className
   * @return
   */
  String buildFileName(Doc doc, String className) {
    String type;

    if (doc.isMethod()) {
      type = "_method_";
    } else if (doc.isClass()) {
      type = "_class_";
    } else if (doc.isField()) {
      type = "_field_";
    } else {
      type = "_";
    }
    return className.toLowerCase() + type + doc.name().toLowerCase();
  }
Exemple #3
0
 public String getName() {
   return mDoc.name();
 }