示例#1
0
  /** Returns true if the given element is hidden. */
  private static boolean isHidden(Doc doc) {
    // Methods, fields, constructors.
    if (doc instanceof MemberDoc) {
      return hasHideAnnotation(doc);
    }

    // Classes, interfaces, enums, annotation types.
    if (doc instanceof ClassDoc) {
      ClassDoc classDoc = (ClassDoc) doc;

      // Check the containing package.
      if (hasHideAnnotation(classDoc.containingPackage())) {
        return true;
      }

      // Check the class doc and containing class docs if this is a
      // nested class.
      ClassDoc current = classDoc;
      do {
        if (hasHideAnnotation(current)) {
          return true;
        }

        current = current.containingClass();
      } while (current != null);
    }

    return false;
  }
 /**
  * Add comment for each element in the index. If the element is deprecated and it has
  * a @deprecated tag, use that comment. Else if the containing class for this element is
  * deprecated, then add the word "Deprecated." at the start and then print the normal comment.
  *
  * @param element Index element
  * @param contentTree the content tree to which the comment will be added
  */
 protected void addComment(ProgramElementDoc element, Content contentTree) {
   Tag[] tags;
   Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
   HtmlTree div = new HtmlTree(HtmlTag.DIV);
   div.addStyle(HtmlStyle.block);
   if (Util.isDeprecated(element)) {
     div.addContent(span);
     if ((tags = element.tags("deprecated")).length > 0)
       addInlineDeprecatedComment(element, tags[0], div);
     contentTree.addContent(div);
   } else {
     ClassDoc cont = element.containingClass();
     while (cont != null) {
       if (Util.isDeprecated(cont)) {
         div.addContent(span);
         contentTree.addContent(div);
         break;
       }
       cont = cont.containingClass();
     }
     addSummaryComment(element, contentTree);
   }
 }
示例#3
0
 /**
  * According to the Java Language Specifications, all the outer classes and static inner classes
  * are core classes.
  */
 public static boolean isCoreClass(ClassDoc cd) {
   return cd.containingClass() == null || cd.isStatic();
 }