示例#1
0
 /**
  * Return the sub-class/interface list for the class/interface passed.
  *
  * @param cd class/interface whose sub-class/interface list is required.
  * @param isEnum true if the subclasses should be forced to come from the enum tree.
  */
 public List subs(ClassDoc cd, boolean isEnum) {
   if (isEnum) {
     return get(subEnums, cd);
   } else if (cd.isAnnotationType()) {
     return get(subAnnotationTypes, cd);
   } else if (cd.isInterface()) {
     return get(subinterfaces, cd);
   } else if (cd.isClass()) {
     return get(subclasses, cd);
   } else {
     return null;
   }
 }
示例#2
0
 /**
  * Given a ClassDoc, return the name of its type (Class, Interface, etc.).
  *
  * @param cd the ClassDoc to check.
  * @param lowerCaseOnly true if you want the name returned in lower case. If false, the first
  *     letter of the name is capatilized.
  * @return
  */
 public static String getTypeName(Configuration config, ClassDoc cd, boolean lowerCaseOnly) {
   String typeName = "";
   if (cd.isOrdinaryClass()) {
     typeName = "doclet.Class";
   } else if (cd.isInterface()) {
     typeName = "doclet.Interface";
   } else if (cd.isException()) {
     typeName = "doclet.Exception";
   } else if (cd.isError()) {
     typeName = "doclet.Error";
   } else if (cd.isAnnotationType()) {
     typeName = "doclet.AnnotationType";
   } else if (cd.isEnum()) {
     typeName = "doclet.Enum";
   }
   return config.getText(lowerCaseOnly ? typeName.toLowerCase() : typeName);
 }
 /**
  * Add the package annotation list.
  *
  * @param contentTree the content tree to which the package annotation list will be added
  */
 protected void addPackageAnnotationList(Content contentTree) throws IOException {
   if ((!classdoc.isAnnotationType())
       || pkgToPackageAnnotations == null
       || pkgToPackageAnnotations.isEmpty()) {
     return;
   }
   Content table =
       HtmlTree.TABLE(
           HtmlStyle.useSummary,
           0,
           3,
           0,
           useTableSummary,
           getTableCaption(
               configuration.getResource(
                   "doclet.ClassUse_PackageAnnotation",
                   getLink(
                       new LinkInfoImpl(
                           configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));
   table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
   Content tbody = new HtmlTree(HtmlTag.TBODY);
   Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
   for (int i = 0; it.hasNext(); i++) {
     PackageDoc pkg = it.next();
     HtmlTree tr = new HtmlTree(HtmlTag.TR);
     if (i % 2 == 0) {
       tr.addStyle(HtmlStyle.altColor);
     } else {
       tr.addStyle(HtmlStyle.rowColor);
     }
     Content tdFirst =
         HtmlTree.TD(HtmlStyle.colFirst, getPackageLink(pkg, new StringContent(pkg.name())));
     tr.addContent(tdFirst);
     HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
     tdLast.addStyle(HtmlStyle.colLast);
     addSummaryComment(pkg, tdLast);
     tr.addContent(tdLast);
     tbody.addContent(tr);
   }
   table.addContent(tbody);
   Content li = HtmlTree.LI(HtmlStyle.blockList, table);
   contentTree.addContent(li);
 }