當前位置: 首頁>>代碼示例>>Java>>正文


Java RootDoc類代碼示例

本文整理匯總了Java中com.sun.javadoc.RootDoc的典型用法代碼示例。如果您正苦於以下問題:Java RootDoc類的具體用法?Java RootDoc怎麽用?Java RootDoc使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RootDoc類屬於com.sun.javadoc包,在下文中一共展示了RootDoc類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRootDoc

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
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;
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:21,代碼來源:T8147801.java

示例2: startDoc

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
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;
}
 
開發者ID:vdr007,項目名稱:ThriftyPaxos,代碼行數:17,代碼來源:Doclet.java

示例3: startGeneration

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
/**
 * 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();
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:24,代碼來源:AbstractDoclet.java

示例4: generateIndexFile

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
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);
}
 
開發者ID:WinRoad-NET,項目名稱:htmldoclet4jdk8,代碼行數:17,代碼來源:HtmlDoclet.java

示例5: test

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:T8147801.java

示例6: test

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
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();
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:20,代碼來源:T8147801.java

示例7: start

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
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;
}
 
開發者ID:emily-e,項目名稱:webframework,代碼行數:17,代碼來源:ScriptingObjectDoclet.java

示例8: loadAsResource

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
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;
	}
}
 
開發者ID:emily-e,項目名稱:webframework,代碼行數:20,代碼來源:ScriptingObjectDoclet.java

示例9: collectDomainModels

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
@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;
}
 
開發者ID:myunusov,項目名稱:maxur-ldoc,代碼行數:20,代碼來源:Domain.java

示例10: testNotConstants

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
@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));
}
 
開發者ID:rnveach,項目名稱:checkstyle-backport-jre6,代碼行數:22,代碼來源:TokenTypesDocletTest.java

示例11: testEmptyJavadoc

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
@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.
    }
}
 
開發者ID:rnveach,項目名稱:checkstyle-backport-jre6,代碼行數:25,代碼來源:TokenTypesDocletTest.java

示例12: testCorrect

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
@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."));

}
 
開發者ID:rnveach,項目名稱:checkstyle-backport-jre6,代碼行數:23,代碼來源:TokenTypesDocletTest.java

示例13: testJavadocTagPassValidation

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
@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));
}
 
開發者ID:rnveach,項目名稱:checkstyle-backport-jre6,代碼行數:17,代碼來源:TokenTypesDocletTest.java

示例14: start

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
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;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:25,代碼來源:Template.java

示例15: start

import com.sun.javadoc.RootDoc; //導入依賴的package包/類
/** 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;
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:20,代碼來源:PluginConfigDoclet.java


注:本文中的com.sun.javadoc.RootDoc類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。