public static void writePackage(PackageInfo pkg) { // these this and the description are in the same directory, // so it's okay Data data = makePackageHDF(); String name = pkg.name(); data.setValue("package.name", name); data.setValue("package.since.key", SinceTagger.keyForName(pkg.getSince())); data.setValue("package.since.name", pkg.getSince()); data.setValue("package.descr", "...description..."); pkg.setFederatedReferences(data, "package"); makeClassListHDF(data, "package.annotations", ClassInfo.sortByName(pkg.getAnnotations())); makeClassListHDF(data, "package.interfaces", ClassInfo.sortByName(pkg.getInterfaces())); makeClassListHDF(data, "package.classes", ClassInfo.sortByName(pkg.ordinaryClasses())); makeClassListHDF(data, "package.modules", ClassInfo.sortByName(pkg.modules())); makeClassListHDF(data, "package.enums", ClassInfo.sortByName(pkg.enums())); makeClassListHDF(data, "package.exceptions", ClassInfo.sortByName(pkg.exceptions())); makeClassListHDF(data, "package.errors", ClassInfo.sortByName(pkg.errors())); TagInfo[] shortDescrTags = pkg.firstSentenceTags(); TagInfo[] longDescrTags = pkg.inlineTags(); TagInfo.makeHDF(data, "package.shortDescr", shortDescrTags); TagInfo.makeHDF(data, "package.descr", longDescrTags); data.setValue( "package.hasLongDescr", TagInfo.tagsEqual(shortDescrTags, longDescrTags) ? "0" : "1"); String filename = Doclava.javadocDir + pkg.relativePath(); setPageTitle(data, name); ClearPage.write(data, "package.cs", filename); filename = javadocDir + pkg.fullDescriptionFile(); setPageTitle(data, name + " Details"); ClearPage.write(data, "package-descr.cs", filename); Proofread.writePackage(filename, pkg.inlineTags()); }
public static Data makePackageHDF() { Data data = makeHDF(); ClassInfo[] classes = Converter.rootClasses(); SortedMap<String, PackageInfo> sorted = new TreeMap<String, PackageInfo>(); for (ClassInfo cl : classes) { PackageInfo pkg = cl.containingPackage(); String name; if (pkg == null) { name = ""; } else { name = pkg.name(); } sorted.put(name, pkg); } int i = 0; for (String s : sorted.keySet()) { PackageInfo pkg = sorted.get(s); if (pkg.isHidden()) { continue; } Boolean allHidden = true; int pass = 0; ClassInfo[] classesToCheck = null; while (pass < 5) { switch (pass) { case 0: classesToCheck = pkg.ordinaryClasses(); break; case 1: classesToCheck = pkg.enums(); break; case 2: classesToCheck = pkg.errors(); break; case 3: classesToCheck = pkg.exceptions(); break; case 4: classesToCheck = pkg.getInterfaces(); break; default: System.err.println("Error reading package: " + pkg.name()); break; } for (ClassInfo cl : classesToCheck) { if (!cl.isHidden()) { allHidden = false; break; } } if (!allHidden) { break; } pass++; } if (allHidden) { continue; } data.setValue("reference", "1"); data.setValue("reference.apilevels", sinceTagger.hasVersions() ? "1" : "0"); data.setValue("docs.packages." + i + ".name", s); data.setValue("docs.packages." + i + ".link", pkg.htmlPage()); data.setValue("docs.packages." + i + ".since.key", SinceTagger.keyForName(pkg.getSince())); data.setValue("docs.packages." + i + ".since.name", pkg.getSince()); TagInfo.makeHDF(data, "docs.packages." + i + ".shortDescr", pkg.firstSentenceTags()); i++; } sinceTagger.writeVersionNames(data); return data; }