/**
  * Return true if the given Doc should be included in the serialized form.
  *
  * @param doc the Doc object to check for serializability.
  */
 private static boolean serialDocInclude(Doc doc) {
   if (doc.isEnum()) {
     return false;
   }
   Tag[] serial = doc.tags("serial");
   if (serial.length > 0) {
     String serialtext = StringUtils.toLowerCase(serial[0].text());
     if (serialtext.indexOf("exclude") >= 0) {
       return false;
     } else if (serialtext.indexOf("include") >= 0) {
       return true;
     }
   }
   return true;
 }
 /**
  * Determine if the program element is shown, according to the given level of visibility.
  *
  * @param ped The given program element.
  * @param visLevel The desired visibility level; "public", "protected", "package" or "private". If
  *     null, only check for an exclude tag.
  * @return boolean Set if this element is shown.
  */
 public boolean shownElement(Doc doc, String visLevel) {
   // If a doc block contains @exclude or a similar such tag,
   // then don't display it.
   if (doExclude && excludeTag != null && doc != null) {
     String rct = doc.getRawCommentText();
     if (rct != null && rct.indexOf(excludeTag) != -1) {
       return false;
     }
   }
   if (visLevel == null) {
     return true;
   }
   ProgramElementDoc ped = null;
   if (doc instanceof ProgramElementDoc) {
     ped = (ProgramElementDoc) doc;
   }
   if (visLevel.compareTo("private") == 0) return true;
   // Show all that is not private
   if (visLevel.compareTo("package") == 0) return !ped.isPrivate();
   // Show all that is not private or package
   if (visLevel.compareTo("protected") == 0) return !(ped.isPrivate() || ped.isPackagePrivate());
   // Show all that is not private or package or protected,
   // i.e. all that is public
   if (visLevel.compareTo("public") == 0) return ped.isPublic();
   return false;
 } // shownElement()
Exemple #3
0
 /**
  * Return true if the given Doc is deprecated.
  *
  * @param doc the Doc to check.
  * @return true if the given Doc is deprecated.
  */
 public static boolean isDeprecated(Doc doc) {
   if (doc.tags("deprecated").length > 0) {
     return true;
   }
   AnnotationDesc[] annotationDescList;
   if (doc instanceof PackageDoc) annotationDescList = ((PackageDoc) doc).annotations();
   else annotationDescList = ((ProgramElementDoc) doc).annotations();
   for (int i = 0; i < annotationDescList.length; i++) {
     if (annotationDescList[i]
         .annotationType()
         .qualifiedName()
         .equals(java.lang.Deprecated.class.getName())) {
       return true;
     }
   }
   return false;
 }
 protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
   Tag[] deprs = member.tags("deprecated");
   if (Util.isDeprecated((ProgramElementDoc) member)) {
     boldText("doclet.Deprecated");
     space();
     if (deprs.length > 0) {
       printInlineDeprecatedComment(member, deprs[0]);
     }
     return;
   } else {
     ClassDoc cd = ((ProgramElementDoc) member).containingClass();
     if (cd != null && Util.isDeprecated(cd)) {
       boldText("doclet.Deprecated");
       space();
     }
   }
   printSummaryComment(member, firstSentenceTags);
 }
 protected void printIndexComment(Doc member) {
   printIndexComment(member, member.firstSentenceTags());
 }
 /**
  * Generates a simple &lt;doc&gt;... XML String with no options
  *
  * @param fieldsAndValues 0th and Even numbered args are fields names, Odds are field values.
  * @see TestHarness#makeSimpleDoc
  */
 public Doc doc(String... fieldsAndValues) {
   Doc d = new Doc();
   d.xml = TestHarness.makeSimpleDoc(fieldsAndValues).toString();
   return d;
 }
 /**
  * Given a <code>Doc</code>, return an anchor name for it.
  *
  * @param d the <code>Doc</code> to check.
  * @return the name of the anchor.
  */
 public static String getAnchorName(Doc d) {
   return "line." + d.position().line();
 }
 /**
  * Return true if the given Doc should be included in the serialized form.
  *
  * @param doc the Doc object to check for serializability.
  */
 public static boolean serialInclude(Doc doc) {
   if (doc == null) {
     return false;
   }
   return doc.isClass() ? serialClassInclude((ClassDoc) doc) : serialDocInclude(doc);
 }