Java 类com.sun.javadoc.RootDoc 实例源码

项目:wrdocletbase    文件:AbstractDoclet.java   
/**
 * Start the generation of files. Call generate methods in the individual
 * writers, which will in turn genrate the documentation files. Call the
 * TreeWriter generation first to ensure the Class Hierarchy is built first
 * and then can be used in the later generation.
 * 
 * @see com.sun.javadoc.RootDoc
 */
private void startGeneration(RootDoc root) throws Exception {
    if (root.classes().length == 0) {
        configuration.message.error("doclet.No_Public_Classes_To_Document");
        return;
    }
    configuration.setOptions();
    configuration.getDocletSpecificMsg().notice("doclet.build_version",
            configuration.getDocletSpecificBuildDate());

    WRDoc wrDoc = new WRDoc(configuration);

    generateWRDocFiles(root, wrDoc);

    configuration.tagletManager.printReport();
}
项目:htmldoclet4jdk8    文件:HtmlDoclet.java   
protected void generateIndexFile(RootDoc root, WRDoc wrDoc)
        throws Exception {
    List<String> tagList = new ArrayList<String>(wrDoc.getWRTags());
    Collator cmp = Collator.getInstance(java.util.Locale.CHINA);
    Collections.sort(tagList, cmp);
    Map<String, Object> tagMap = new HashMap<String, Object>();
    DocData bean = this.generateDocData(wrDoc);
    Gson gson = new Gson();
    tagMap.put("response", gson.toJson(bean));
    tagMap.put("searchengine", this.configurationEx.searchengine);
    this.configurationEx
            .getWriterFactory()
            .getFreemarkerWriter()
            .generateHtmlFile("index.ftl", tagMap,
                    this.configurationEx.destDirName, null);
}
项目:openjdk-jdk10    文件:T8147801.java   
void test(boolean withOption) {
    System.err.println("Testing " + (withOption ? "with" : "without") + " option");
    try {
        String dump = "";
        RootDoc root = getRootDoc(withOption);
        for (ClassDoc cd: root.specifiedClasses()) {
            dump += dump(cd);
        }
        if (dump.contains("lib.Lib2.i")) {
            if (!withOption) {
                error("control case failed: Lib2 class file was read, unexpectedly, without using option");
            }
        } else {
            if (withOption) {
                error("test case failed: could not read Lib2 class file, using option");
            }
        }
    } catch (ClosedFileSystemException e) {
        error("Unexpected exception: " + e);
    }
    System.err.println();
}
项目:openjdk-jdk10    文件:T8147801.java   
RootDoc getRootDoc(boolean withOption) {
    List<String> opts = new ArrayList<>();
    if (withOption)
        opts.add("-XDfileManager.deferClose=10");
    opts.add("-doclet");
    opts.add(getClass().getName());
    opts.add("-classpath");
    opts.add(jarPath.toString());
    opts.add(Paths.get(System.getProperty("test.src"), "p", "Test.java").toString());
    System.err.println("javadoc opts: " + opts);
    int rc = com.sun.tools.javadoc.Main.execute(
            "javadoc",
            // by specifying our own class loader, we get the same Class instance as this
            getClass().getClassLoader(),
            opts.toArray(new String[opts.size()]));
    if (rc != 0) {
        error("unexpected exit from javadoc or doclet: " + rc);
    }
    return cachedRoot;
}
项目:htmldoclet4jdk7    文件:HtmlDoclet.java   
protected void generateIndexFile(RootDoc root, WRDoc wrDoc)
        throws Exception {
    List<String> tagList = new ArrayList<String>(wrDoc.getWRTags());
    Collator cmp = Collator.getInstance(java.util.Locale.CHINA);
    Collections.sort(tagList, cmp);
    Map<String, Object> tagMap = new HashMap<String, Object>();
    DocData bean = this.generateDocData(wrDoc);
    Gson gson = new Gson();
    tagMap.put("response", gson.toJson(bean));
    tagMap.put("searchengine", this.configurationEx.searchengine);
    this.configurationEx
            .getWriterFactory()
            .getFreemarkerWriter()
            .generateHtmlFile("index.ftl", tagMap,
                    this.configurationEx.destDirName, null);
}
项目:openjdk9    文件:T8147801.java   
void test(boolean withOption) {
    System.err.println("Testing " + (withOption ? "with" : "without") + " option");
    try {
        RootDoc root = getRootDoc(withOption);
        for (ClassDoc cd: root.specifiedClasses()) {
            dump("", cd);
        }
        if (!withOption) {
            error("expected option did not occur");
        }
    } catch (ClosedFileSystemException e) {
        if (withOption) {
            error("Unexpected exception: " + e);
        } else {
            System.err.println("Exception received as expected: " + e);
        }
    }
    System.err.println();
}
项目:openjdk9    文件:T8147801.java   
RootDoc getRootDoc(boolean withOption) {
    List<String> opts = new ArrayList<>();
    if (withOption)
        opts.add("-XDfileManager.deferClose=10");
    opts.add("-doclet");
    opts.add(getClass().getName());
    opts.add("-classpath");
    opts.add(jarPath.toString());
    opts.add(Paths.get(System.getProperty("test.src"), "p", "Test.java").toString());
    System.err.println("javadoc opts: " + opts);
    int rc = com.sun.tools.javadoc.Main.execute(
            "javadoc",
            // by specifying our own class loader, we get the same Class instance as this
            getClass().getClassLoader(),
            opts.toArray(new String[opts.size()]));
    if (rc != 0) {
        error("unexpected exit from javadoc or doclet: " + rc);
    }
    return cachedRoot;
}
项目:ThriftyPaxos    文件:Doclet.java   
private boolean startDoc(RootDoc root) throws IOException {
    ClassDoc[] classes = root.classes();
    String[][] options = root.options();
    for (String[] op : options) {
        if (op[0].equals("destdir")) {
            destDir = op[1];
        }
    }
    for (ClassDoc clazz : classes) {
        processClass(clazz);
    }
    if (errorCount > 0) {
        throw new IOException("FAILED: " + errorCount + " errors found");
    }
    return true;
}
项目:webframework    文件:ScriptingObjectDoclet.java   
public static boolean start(final RootDoc root) throws IOException, ClassNotFoundException {
    final Options opt = new Options(root.options());

    final Map<String, Factory> factories = new HashMap<>();
    final Map<String, String> typeAliases = new HashMap<>();
    final Map<String, ObjectType> types = loadBuiltInTypes(typeAliases);
    final Set<String> builtIns = new HashSet<>(types.keySet());


    for(final String factoryName: opt.factoryNames) {
        factories.put(factoryName, parseFactory(factoryName, root, types));
    }
    if(opt.json) { writeJson(opt.outputPath, types, builtIns); }
    if(opt.html) { writeHtml(opt.outputPath, types, factories); }
    return true;
}
项目:webframework    文件:ScriptingObjectDoclet.java   
private static ObjectType loadAsResource(final Class type,
        final RootDoc root,
        final Map<String, ObjectType> types) {
    final String resource = type.getName().replace(".", "/") + ".scripting.json";
    System.out.println("LOAD: " + resource);
    if(type.getClassLoader() == null) { return null; }
    try (final InputStream json = type.getClassLoader().getResourceAsStream(resource)) {
        if(json == null) { return null; }
        final JsonObject obj =
            JsonObject.read(new InputStreamReader(json, java.nio.charset.StandardCharsets.UTF_8));
        final ObjectType struct = codec.toStruct(obj);
        types.put(type.getName(), struct);
        loadImplicitTypes(struct, root, types);
        return struct;
    } catch (final IOException ioe) {
        ioe.printStackTrace();
        return null;
    }
}
项目:maxur-ldoc    文件:Domain.java   
@NotNull
private Set<SubDomain> collectDomainModels(final RootDoc root) {
    final Set<SubDomain> result = Arrays.stream(root.specifiedPackages())
        .map(SubDomain::makeBy)
        .filter(Optional::isPresent)
        .map(Optional::get)
        .collect(Collectors.toSet());


    result.forEach(
        sd -> {
            Arrays.stream(root.specifiedPackages()).forEach(
                sd::add
            );
        }
    );

    return result;
}
项目:checkstyle-backport-jre6    文件:TokenTypesDocletTest.java   
@Test
public void testNotConstants() throws Exception {
    // Token types must be public int constants, which means that they must have
    // modifiers public, static, final and type int, because they are referenced statically in
    // a lot of different places, must not be changed and an int value is used to encrypt
    // a token type.
    final ListBuffer<String[]> options = new ListBuffer<String[]>();
    options.add(new String[] {"-doclet", "TokenTypesDoclet"});
    options.add(new String[] {"-destfile", "target/tokentypes.properties"});

    final ListBuffer<String> names = new ListBuffer<String>();
    names.add(getPath("InputTokenTypesDocletNotConstants.java"));

    final Context context = new Context();
    final TestMessager test = new TestMessager(context);
    assertNotNull("should be able to create TestMessager without issue", test);
    final JavadocTool javadocTool = JavadocTool.make0(context);
    final RootDoc rootDoc = getRootDoc(javadocTool, options, names);

    assertTrue("Should process valid root doc", TokenTypesDoclet.start(rootDoc));
}
项目:checkstyle-backport-jre6    文件:TokenTypesDocletTest.java   
@Test
public void testEmptyJavadoc() throws Exception {
    final ListBuffer<String[]> options = new ListBuffer<String[]>();
    options.add(new String[] {"-destfile", "target/tokentypes.properties"});

    final ListBuffer<String> names = new ListBuffer<String>();
    names.add(getPath("InputTokenTypesDocletEmptyJavadoc.java"));

    final Context context = new Context();
    final TestMessager test = new TestMessager(context);
    assertNotNull("should be able to create TestMessager without issue", test);
    final JavadocTool javadocTool = JavadocTool.make0(context);
    final RootDoc rootDoc = getRootDoc(javadocTool, options, names);

    try {
        TokenTypesDoclet.start(rootDoc);
        fail("IllegalArgumentException is expected");
    }
    catch (IllegalArgumentException expected) {
        // Token types must have first sentence of Javadoc summary
        // so that a brief description could be provided. Otherwise,
        // an IllegalArgumentException is thrown.
    }
}
项目:checkstyle-backport-jre6    文件:TokenTypesDocletTest.java   
@Test
public void testCorrect() throws Exception {
    final ListBuffer<String[]> options = new ListBuffer<String[]>();
    options.add(new String[] {"-destfile", "target/tokentypes.properties"});

    final ListBuffer<String> names = new ListBuffer<String>();
    names.add(getPath("InputTokenTypesDocletCorrect.java"));

    final Context context = new Context();
    final TestMessager test = new TestMessager(context);
    assertNotNull("should be able to create TestMessager without issue", test);
    final JavadocTool javadocTool = JavadocTool.make0(context);
    final RootDoc rootDoc = getRootDoc(javadocTool, options, names);

    assertTrue("Should process valid root doc", TokenTypesDoclet.start(rootDoc));
    final String fileContent =
            FileUtils.readFileToString(new File("target/tokentypes.properties"),
                    StandardCharsets.UTF_8);
    assertTrue("File content is not expected",
            fileContent.startsWith("EOF=The end of file token."));

}
项目:checkstyle-backport-jre6    文件:TokenTypesDocletTest.java   
@Test
public void testJavadocTagPassValidation() throws Exception {
    final ListBuffer<String[]> options = new ListBuffer<String[]>();
    options.add(new String[] {"-destfile", "target/tokentypes.properties"});

    final ListBuffer<String> names = new ListBuffer<String>();
    names.add(getPath("InputTokenTypesDocletJavadocParseError.java"));

    final Context context = new Context();
    final TestMessager test = new TestMessager(context);
    assertNotNull("should be able to create TestMessager without issue", test);
    final JavadocTool javadocTool = JavadocTool.make0(context);
    final RootDoc rootDoc = getRootDoc(javadocTool, options, names);

    assertTrue("Should process valid root doc", TokenTypesDoclet.start(rootDoc));
}
项目:openjfx-8u-dev-tests    文件:Template.java   
public static boolean start(RootDoc doc) throws FileNotFoundException, IOException {
    if(out == null) out = System.out;
    for (ClassDoc cls : doc.classes()) {
        Map<String, MethodDoc> allProps = getPropNames(cls);
        for (MethodDoc m : cls.methods()) {
            String propName = getPropName(m, true);
            if (propName != null) {
                MethodDoc mDeclaring = allProps.get(propName);
                if (mDeclaring != null) {
                    boolean supported = false;
                    if (m.name().startsWith("get") || m.name().startsWith("is")) {
                        supported = m.returnType().equals(mDeclaring.returnType());
                    } else if (m.name().startsWith("set")) {
                        supported = m.parameters()[0].type().equals(mDeclaring.returnType());
                    }
                    if (supported) {
                        out.println(cls.qualifiedName() + "." + propName);
                    }
                }
            }
        }
    }
    return true;
}
项目:closure-maven-plugin    文件:PluginConfigDoclet.java   
/** Specified for the Doclet API */
public static boolean start(RootDoc root) {
  PluginConfigDoclet doclet = new PluginConfigDoclet(root);
  boolean ok = true;
  for (String[] optionArr : root.options()) {
    String name = optionArr[0];
    OptionName on = OPTION_NAMES.get(name);
    if (on != null) {
      ImmutableList<String> values = ImmutableList.copyOf(
          Arrays.asList(optionArr).subList(1, optionArr.length));
      ok &= on.configure(doclet, values);
    }
  }

  doclet.run();
  ok &= doclet.okSoFar;

  return ok;
}
项目:apiviz    文件:Graphviz.java   
private static String getExecutable(RootDoc root) {
    String command = "dot";

    try {
        String osName = System.getProperty("os.name");
        if (osName != null && osName.indexOf("Windows") >= 0) {
            File path = Graphviz.getHome(root);
            if (path != null) {
                command = path.getAbsolutePath() + File.separator
                        + "dot.exe";
            } else {
                command = "dot.exe";
            }
        }
    } catch (Exception e) {
        // ignore me!
    }
    return command;
}
项目:freemarker-doclet    文件:FreeMarkerDoclet.java   
public static boolean start(RootDoc root) {
    try {
        Configuration cfg = createConfiguration();
        Template t = cfg.getTemplate(template.getName());

        File f = new File(output);
        FileOutputStream fos = new FileOutputStream(f);
        OutputStreamWriter w = new OutputStreamWriter(fos, Charset.forName("UTF-8"));

        t.process(root, w);
    } catch (Exception e) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        root.printError(sw.toString());

        return false;
    }
    return true;
}
项目:markdoclet    文件:Markdoclet.java   
public static boolean start(RootDoc root) {
    root.printNotice("Parsing Java code");
    final Document document = new JavadocToDocumentConverter(root, title, properties).createDocument();
    root.printNotice("Generating Markdown output to " + outputFile);
    final String error = new DocumentToMarkdownWriter(createOutputWriter()).writeDocument(document);
    final boolean result = (error == null);
    if (error != null) {
        root.printError(error);
    }
    // Because we're mucking around with static fields, we must ensure we reset them too. Yuck.
    title = null;
    properties = null;
    outputFile = null;
    root.printNotice("Done!");
    return result;
}
项目:joinery    文件:DocTestSuite.java   
public static boolean start(final RootDoc root) {
    for (final ClassDoc cls : root.classes()) {
        final List<ProgramElementDoc> elements = new LinkedList<>();
        elements.add(cls);
        elements.addAll(Arrays.asList(cls.constructors()));
        elements.addAll(Arrays.asList(cls.methods()));
        for (final ProgramElementDoc elem : elements) {
            for (final Tag tag : elem.inlineTags()) {
                final String name = tag.name();
                if (name.equals("@code") && tag.text().trim().startsWith(">")) {
                    generateRunner(cls, elem, tag);
                }
            }
        }
    }
    return true;
}
项目:myrobotlab    文件:ListMethodsDoclet.java   
public static boolean start(RootDoc root) {
  ClassDoc[] classes = root.classes();
  for (int i = 0; i < classes.length; i++) {
    System.out.println(classes[i]);
    ClassDoc classdoc = classes[i];
    String x = classdoc.getRawCommentText();
    System.out.println(x);
    MethodDoc[] methods = classes[i].methods();
    for (int j = 0; j < methods.length; j++) {
      MethodDoc m = methods[j];
      System.out.println(m.getRawCommentText());
      if (m.isPublic()) {
        System.out.println("\t" + m.name());
        Parameter[] parameters = m.parameters();
        for (int k = 0; k < parameters.length; k++) {
          Parameter p = parameters[k];
          System.out.println("\t\t" + p.name() + ": " + p.type().qualifiedTypeName());
        }
      }
    }
  }
  return true;
}
项目:rest-doclet    文件:RestDoclet.java   
/**
 * Generate documentation here.
 * This method is required for all doclets.
 *
 * @return true on success.
 */
public static boolean start(RootDoc root) {

    Configuration config = new Configuration(root.options());

    Collection<ClassDescriptor> classDescriptors = new ArrayList<ClassDescriptor>();

    for (Collector collector : collectors)
        classDescriptors.addAll(collector.getDescriptors(root));

    Writer writer;
    if (config.getOutputFormat().equals(SwaggerWriter.OUTPUT_OPTION_NAME))
        writer = new SwaggerWriter();
    else
        writer = new SimpleHtmlWriter();


    try {
        writer.write(classDescriptors, config);
        return true;
    } catch (IOException e) {
        e.printStackTrace();
        return false;
    }
}
项目:rest4j    文件:Rest4JDoclet.java   
/**
 * Entry point for Javadoc Doclet.
 *
 * @param root {@link RootDoc} passed in by Javadoc
 * @return is successful or not
 */
public static boolean start(RootDoc root)
{
  final DocInfo docInfo = new DocInfo();

  for (ClassDoc classDoc : root.classes())
  {
    docInfo.setClassDoc(classDoc.qualifiedName(), classDoc);

    for (MethodDoc methodDoc : classDoc.methods())
    {
      docInfo.setMethodDoc(MethodIdentity.create(methodDoc), methodDoc);
    }
  }

  _docInfo.put(_id, docInfo);

  return true;
}
项目:javaontracks    文件:JOTDocletIndexWriter.java   
public String getPathToRoot(Doc doc)
{
    String path = "";
    if (doc != null && !(doc instanceof RootDoc))
    {
        String name = doc.name();
        if (doc instanceof ClassDoc)
        {
            name = ((ClassDoc) doc).containingPackage().name();
        }
        for (int i = 0; i != name.split("\\.").length; i++)
        {
            path += "../";
        }
    }
    return path;
}
项目:javaontracks    文件:JOTDocletNavView.java   
public String getPathToRoot()
{
    String path = "";
    Doc doc = (Doc) getVariables().get("curitem");
    if (getVariables().get("manualPath") != null)
    {
        path = (String) getVariables().get("manualPath");
    } else if (doc != null && !(doc instanceof RootDoc))
    {
        String name = doc.name();
        if (doc instanceof ClassDoc)
        {
            name = ((ClassDoc) doc).containingPackage().name();
        }
        for (int i = 0; i != name.split("\\.").length; i++)
        {
            path += "../";
        }
    }
    return path;
}
项目:minium    文件:DocumentationDoclet.java   
public static boolean start(RootDoc root) throws IOException {
    File outputDir = readOutputDir(root);
    outputDir.mkdirs();
    try (Writer writer = createFileWriter(outputDir, "api/methods.json")) {
        ApiJSONGenerator apiJSONGenerator = new ApiJSONGenerator(root, writer);
        apiJSONGenerator.addClass(WEB_ELEMENTS);
        apiJSONGenerator.addClass(INTERACTABLES);
        apiJSONGenerator.addClass(BROWSER);
        apiJSONGenerator.print();
    }
    try (Writer writer = createFileWriter(outputDir, "api/configuration.md")) {
        new ApiMarkdownGenerator(root, writer, CONFIGURATION).print();
    }
    try (Writer writer = createFileWriter(outputDir, "api/browser.md")) {
        new ApiMarkdownGenerator(root, writer, BROWSER).print();
    }
    try (Writer writer = createFileWriter(outputDir, "api/web-elements.md")) {
        new ApiMarkdownGenerator(root, writer, WEB_ELEMENTS).print();
    }
    try (Writer writer = createFileWriter(outputDir, "api/interactable.md")) {
        new ApiMarkdownGenerator(root, writer, INTERACTABLES).print();
    }
    return true;
}
项目:checkstyle    文件:TokenTypesDocletTest.java   
@Test
public void testNotConstants() throws Exception {
    // Token types must be public int constants, which means that they must have
    // modifiers public, static, final and type int, because they are referenced statically in
    // a lot of different places, must not be changed and an int value is used to encrypt
    // a token type.
    final ListBuffer<String[]> options = new ListBuffer<>();
    options.add(new String[] {"-doclet", "TokenTypesDoclet"});
    options.add(new String[] {"-destfile", "target/tokentypes.properties"});

    final ListBuffer<String> names = new ListBuffer<>();
    names.add(getPath("InputTokenTypesDocletNotConstants.java"));

    final Context context = new Context();
    final TestMessager test = new TestMessager(context);
    assertNotNull("should be able to create TestMessager without issue", test);
    final JavadocTool javadocTool = JavadocTool.make0(context);
    final RootDoc rootDoc = getRootDoc(javadocTool, options, names);

    assertTrue("Should process valid root doc", TokenTypesDoclet.start(rootDoc));
}
项目:checkstyle    文件:TokenTypesDocletTest.java   
@Test
public void testEmptyJavadoc() throws Exception {
    final ListBuffer<String[]> options = new ListBuffer<>();
    options.add(new String[] {"-destfile", "target/tokentypes.properties"});

    final ListBuffer<String> names = new ListBuffer<>();
    names.add(getPath("InputTokenTypesDocletEmptyJavadoc.java"));

    final Context context = new Context();
    final TestMessager test = new TestMessager(context);
    assertNotNull("should be able to create TestMessager without issue", test);
    final JavadocTool javadocTool = JavadocTool.make0(context);
    final RootDoc rootDoc = getRootDoc(javadocTool, options, names);

    try {
        TokenTypesDoclet.start(rootDoc);
        fail("IllegalArgumentException is expected");
    }
    catch (IllegalArgumentException expected) {
        // Token types must have first sentence of Javadoc summary
        // so that a brief description could be provided. Otherwise,
        // an IllegalArgumentException is thrown.
    }
}
项目:checkstyle    文件:TokenTypesDocletTest.java   
@Test
public void testCorrect() throws Exception {
    final ListBuffer<String[]> options = new ListBuffer<>();
    options.add(new String[] {"-destfile", "target/tokentypes.properties"});

    final ListBuffer<String> names = new ListBuffer<>();
    names.add(getPath("InputTokenTypesDocletCorrect.java"));

    final Context context = new Context();
    final TestMessager test = new TestMessager(context);
    assertNotNull("should be able to create TestMessager without issue", test);
    final JavadocTool javadocTool = JavadocTool.make0(context);
    final RootDoc rootDoc = getRootDoc(javadocTool, options, names);

    assertTrue("Should process valid root doc", TokenTypesDoclet.start(rootDoc));
    final String fileContent =
            FileUtils.readFileToString(new File("target/tokentypes.properties"),
                    StandardCharsets.UTF_8);
    assertTrue("File content is not expected",
            fileContent.startsWith("EOF=The end of file token."));
}
项目:checkstyle    文件:TokenTypesDocletTest.java   
@Test
public void testJavadocTagPassValidation() throws Exception {
    final ListBuffer<String[]> options = new ListBuffer<>();
    options.add(new String[] {"-destfile", "target/tokentypes.properties"});

    final ListBuffer<String> names = new ListBuffer<>();
    names.add(getPath("InputTokenTypesDocletJavadocParseError.java"));

    final Context context = new Context();
    final TestMessager test = new TestMessager(context);
    assertNotNull("should be able to create TestMessager without issue", test);
    final JavadocTool javadocTool = JavadocTool.make0(context);
    final RootDoc rootDoc = getRootDoc(javadocTool, options, names);

    assertTrue("Should process valid root doc", TokenTypesDoclet.start(rootDoc));
}
项目:qtaste    文件:HTMLFileWriter.java   
/**
 * Prints Test API Component header.
 *
 * @param classDoc the ClassDoc specifying the class
 * @param root the RootDoc passed to the doclet
 */
public void printTestAPIComponentHeader(ClassDoc classDoc, RootDoc root) {
    mOut.println("<H2>QTaste Test API Component Interface " + classDoc.name() + "</H2>");
    mOut.println(classDoc.commentText());

    // factory
    FieldDoc factoryField = TestAPIDoclet.getFactoryField(classDoc, root);
    if (factoryField != null) {
        mOut.println("<P>");
        mOut.println(factoryField.commentText());
    }

    // config tags
    Tag[] tags = classDoc.tags("@config");
    if (tags.length > 0) {
        mOut.println("<DL>");
        mOut.println("<DT><B>Configuration:</B></DT>");
        List<TestAPIDoclet.NameTypeDescription> configList = TestAPIDoclet.getNameTypeDescriptionList(tags);
        for (TestAPIDoclet.NameTypeDescription config : configList) {
            mOut.println("<DD><CODE>" + config.name + "</CODE> (<CODE>" + config.type + "</CODE>) - " + config.description
                  + "</DD>");
        }
        mOut.println("</DL>");
    }
}
项目:qtaste    文件:TestAPIDoclet.java   
/**
 * Returns the factory field doc of a Test API component interface.
 *
 * @param classDoc the ClassDoc specifying the Test API component interface
 * @param root the RootDoc passed to the doclet
 * @return the FieldDoc of the factory field inherited from extended interface
 * or null if no factory field found
 */
public static FieldDoc getFactoryField(ClassDoc classDoc, RootDoc root) {
    ClassDoc ComponentFactory = root.classNamed(TEST_API_KERNEL_PACKAGE + ".ComponentFactory");
    for (ClassDoc interface_ : classDoc.interfaces()) {
        if (isTestAPI(interface_, root)) {
            for (FieldDoc field : interface_.fields()) {
                if (field.name().equals("factory")) {
                    ClassDoc fieldClassDoc = field.type().asClassDoc();
                    if ((fieldClassDoc != null) && fieldClassDoc.subclassOf(ComponentFactory)) {
                        return field;
                    }
                }
            }
        }
    }
    return null;
}
项目:qtaste    文件:TestAPIDoclet.java   
/**
 * Returns an array of the classes that are Test API components interfaces,
 * sorted alphabetically.
 *
 * @param root the RootDoc passed to the doclet
 * @return an array of the classes that are Test API components interfaces,
 * sorted alphabetically
 */
private static ClassDoc[] filterTestAPIComponents(RootDoc root) {
    ClassDoc[] classes = root.classes();
    sortClassesAlphabetically(classes);

    ArrayList<ClassDoc> verbsList = new ArrayList<>(classes.length);
    for (ClassDoc classDoc : classes) {
        if (isTestAPI(classDoc, root)) {
            // Exclude factory classes (MultipleInstancesComponent, SingletonComponent, ...)
            if (!classDoc.qualifiedTypeName().startsWith(TEST_API_KERNEL_PACKAGE)) {
                verbsList.add(classDoc);
            }
        }
    }

    return verbsList.toArray(new ClassDoc[verbsList.size()]);
}
项目:tez    文件:ConfigStandardDoclet.java   
public static boolean start(RootDoc root) {
  //look for debug flag
  for (String[] opts : root.options()) {
    for (String opt : opts) {
      if (opt.equals(DEBUG_SWITCH)) {
        debugMode = true;
      }
    }
  }

  logMessage("Running doclet " + ConfigStandardDoclet.class.getSimpleName());
  ClassDoc[] classes = root.classes();
  for (int i = 0; i < classes.length; ++i) {
    processDoc(classes[i]);
  }

  return true;
}
项目:markdown-doclet    文件:MarkdownDoclet.java   
/**
 * Construct a new Markdown Doclet.
 * @param options The command line options.
 * @param rootDoc The root document.
 */
public MarkdownDoclet(Options options, RootDoc rootDoc) {
    this.options = options;
    this.rootDoc = rootDoc;
    tagRenderers.put("@author", SimpleTagRenderer.INSTANCE);
    tagRenderers.put("@version", SimpleTagRenderer.INSTANCE);
    tagRenderers.put("@return", SimpleTagRenderer.INSTANCE);
    tagRenderers.put("@deprecated", SimpleTagRenderer.INSTANCE);
    tagRenderers.put("@since", SimpleTagRenderer.INSTANCE);
    tagRenderers.put("@param", ParamTagRenderer.INSTANCE);
    tagRenderers.put("@throws", ThrowsTagRenderer.INSTANCE);
    tagRenderers.put("@see", SeeTagRenderer.INSTANCE);
    UmlTagRenderer umlTagRenderer = new UmlTagRenderer();
    tagRenderers.put("@uml", umlTagRenderer);
    tagRenderers.put("@startuml", umlTagRenderer);
    tagRenderers.put("@enduml", TagRenderer.ELIDE);
    tagRenderers.put("@todo", new TodoTagRenderer());
}
项目:PrivacyStreams    文件:PSDoclet.java   
private boolean build(RootDoc rootDoc) {
    this.readOptions(rootDoc.options());

    ClassDoc[] classes = rootDoc.classes();

    for (int i = 0; i < classes.length; ++i) {
        ClassDoc classDoc = classes[i];

        PSItemDoc itemDoc = PSItemDoc.build(classDoc);
        if (itemDoc != null) this.psItems.add(itemDoc);

        PSOperatorWrapperDoc operatorWrapperDoc = PSOperatorWrapperDoc.build(classDoc);
        if (operatorWrapperDoc != null) this.psOperatorWrappers.add(operatorWrapperDoc);

        if (Utils.instanceOf(classDoc, Consts.TYPE_P_STREAM)) {
            for (MethodDoc methodDoc : classDoc.methods()) {
                PSPipelineDoc pipelineDoc = PSPipelineDoc.build(classDoc, methodDoc);
                if (pipelineDoc != null) {
                    this.psPipelines.add(pipelineDoc);
                }
            }
        }
    }

    this.dump();
    return true;
}
项目:wrdocletbase    文件:AbstractDoclet.java   
/**
 * The method that starts the execution of the doclet.
 * 
 * @param doclet
 *            the doclet to start the execution for.
 * @param root
 *            the {@link com.sun.javadoc.RootDoc} that points to the source
 *            to document.
 * @return true if the doclet executed without error. False otherwise.
 */
public boolean start(AbstractDoclet doclet, RootDoc root) {
    configuration = configuration();
    configuration.root = root;
    try {
        doclet.startGeneration(root);
    } catch (Exception exc) {
        exc.printStackTrace();
        return false;
    }
    return true;
}
项目:wrdocletbase    文件:AbstractDoclet.java   
/**
 * Generate additional documentation that is added to the API documentation.
 * 
 * @param root
 *            the RootDoc of source to document.
 * @param classtree
 *            the data structure representing the class tree.
 * @throws Exception builderFactory may throw exception
 */
protected void generateOtherFiles(RootDoc root, ClassTree classtree)
        throws Exception {
    BuilderFactory builderFactory = configuration.getBuilderFactory();
    AbstractBuilder constantsSummaryBuilder = builderFactory
            .getConstantsSummaryBuider();
    constantsSummaryBuilder.build();
    AbstractBuilder serializedFormBuilder = builderFactory
            .getSerializedFormBuilder();
    serializedFormBuilder.build();
}
项目:OpenJSharp    文件:BatchEnvironment.java   
/**
 * Creates a new BatchEnvironment with the specified RootDoc.
 **/
public BatchEnvironment(RootDoc rootDoc) {
    this.rootDoc = rootDoc;

    /*
     * Initialize cached ClassDoc for types used by rmic.  Note
     * that any of these could be null if the boot class path is
     * incorrect, which could cause a NullPointerException later.
     */
    docRemote = rootDoc().classNamed(REMOTE);
    docException = rootDoc().classNamed(EXCEPTION);
    docRemoteException = rootDoc().classNamed(REMOTE_EXCEPTION);
    docRuntimeException = rootDoc().classNamed(RUNTIME_EXCEPTION);
}