Example #1
0
  /**
   * Process the methods in the class.
   *
   * @param md An array of MethodDoc objects
   */
  public void processMethods(ClassDoc cd, MethodDoc[] md) {
    if (trace) System.out.println("PROCESSING " + cd.name() + " METHODS, number = " + md.length);
    for (int i = 0; i < md.length; i++) {
      String methodName = md[i].name();
      if (trace) System.out.println("PROCESSING METHOD: " + methodName);
      // Skip <init> and <clinit>
      if (methodName.startsWith("<")) continue;
      // Only save the shown elements
      if (!shownElement(md[i], memberVisibilityLevel)) continue;
      outputFile.print("    <method name=\"" + methodName + "\"");
      com.sun.javadoc.Type retType = md[i].returnType();
      if (retType.qualifiedTypeName().compareTo("void") == 0) {
        // Don't add a return attribute if the return type is void
        outputFile.println();
      } else {
        outputFile.print(" return=\"");
        emitType(retType);
        outputFile.println("\"");
      }
      outputFile.print("      abstract=\"" + md[i].isAbstract() + "\"");
      outputFile.print(" native=\"" + md[i].isNative() + "\"");
      outputFile.println(" synchronized=\"" + md[i].isSynchronized() + "\"");
      addCommonModifiers(md[i], 6);
      outputFile.println(">");
      // Generate the parameter elements, if any
      Parameter[] params = md[i].parameters();
      for (int j = 0; j < params.length; j++) {
        outputFile.print("      <param name=\"" + params[j].name() + "\"");
        outputFile.print(" type=\"");
        emitType(params[j].type());
        outputFile.println("\"/>");
      }

      // Generate the exception elements if any exceptions are thrown
      processExceptions(md[i].thrownExceptions());

      addDocumentation(md[i], 6);

      outputFile.println("    </method>");
    } // for
  } // processMethods()
Example #2
0
 /**
  * Build the emittable type name. The type may be an array and/or a generic type.
  *
  * @param type A Type object
  * @return The emittable type name
  */
 private String buildEmittableTypeString(com.sun.javadoc.Type type) {
   if (type == null) {
     return null;
   }
   // type.toString() returns the fully qualified name of the type
   // including the dimension and the parameters we just need to
   // escape the generic parameters brackets so that the XML
   // generated is correct
   String name =
       type.toString().replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
   if (name.startsWith("<<ambiguous>>")) {
     name = name.substring(13);
   }
   return name;
 }