コード例 #1
0
  public static void main(String[] args) throws Exception {
    System.out.println("Scan http api");

    ApiDocs apiDocs = scan(args);
    Output output = createOutput(args);
    String outputDir = getOutputDir(args);
    System.out.println("Output class: " + output.getClass().getName());
    System.out.println("Output dir:  " + outputDir);

    output.output(apiDocs, outputDir, getOutputArgs(args));
  }
コード例 #2
0
ファイル: DocFinder.java プロジェクト: karianna/jdk8_tl
  /**
   * Search for the requested comments in the given method. If it does not have comments, return
   * documentation from the overriden method if possible. If the overriden method does not exist or
   * does not have documentation to inherit, search for documentation to inherit from implemented
   * methods.
   *
   * @param input the input object used to perform the search.
   * @return an Output object representing the documentation that was found.
   */
  public static Output search(Input input) {
    Output output = new Output();
    if (input.isInheritDocTag) {
      // Do nothing because "method" does not have any documentation.
      // All it has it {@inheritDoc}.
    } else if (input.taglet == null) {
      // We want overall documentation.
      output.inlineTags =
          input.isFirstSentence ? input.method.firstSentenceTags() : input.method.inlineTags();
      output.holder = input.method;
    } else {
      input.taglet.inherit(input, output);
    }

    if (output.inlineTags != null && output.inlineTags.length > 0) {
      return output;
    }
    output.isValidInheritDocTag = false;
    Input inheritedSearchInput = input.copy();
    inheritedSearchInput.isInheritDocTag = false;
    if (input.method.overriddenMethod() != null) {
      inheritedSearchInput.method = input.method.overriddenMethod();
      output = search(inheritedSearchInput);
      output.isValidInheritDocTag = true;
      if (output != null && output.inlineTags.length > 0) {
        return output;
      }
    }
    // NOTE:  When we fix the bug where ClassDoc.interfaceTypes() does
    //       not pass all implemented interfaces, we will use the
    //       appropriate method here.
    MethodDoc[] implementedMethods = (new ImplementedMethods(input.method, null)).build(false);
    for (int i = 0; i < implementedMethods.length; i++) {
      inheritedSearchInput.method = implementedMethods[i];
      output = search(inheritedSearchInput);
      output.isValidInheritDocTag = true;
      if (output != null && output.inlineTags.length > 0) {
        return output;
      }
    }
    return output;
  }