/**
  * 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;
 }
Пример #2
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);
 }
Пример #4
0
  /** {@inheritDoc} */
  public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
    Type returnType = ((MethodDoc) holder).returnType();
    Tag[] tags = holder.tags(name);

    // Make sure we are not using @return tag on method with void return type.
    if (returnType.isPrimitive() && returnType.typeName().equals("void")) {
      if (tags.length > 0) {
        writer.getMsgRetriever().warning(holder.position(), "doclet.Return_tag_on_void_method");
      }
      return null;
    }
    // Inherit @return tag if necessary.
    if (tags.length == 0) {
      DocFinder.Output inheritedDoc =
          DocFinder.search(new DocFinder.Input((MethodDoc) holder, this));
      tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
    }
    return tags.length > 0 ? writer.returnTagOutput(tags[0]) : null;
  }
Пример #5
0
 /** {@inheritDoc} */
 public Content deprecatedTagOutput(Doc doc) {
   ContentBuilder result = new ContentBuilder();
   Tag[] deprs = doc.tags("deprecated");
   if (doc instanceof ClassDoc) {
     if (Util.isDeprecated((ProgramElementDoc) doc)) {
       result.addContent(
           HtmlTree.SPAN(
               HtmlStyle.deprecatedLabel,
               new StringContent(configuration.getText("doclet.Deprecated"))));
       result.addContent(RawHtml.nbsp);
       if (deprs.length > 0) {
         Tag[] commentTags = deprs[0].inlineTags();
         if (commentTags.length > 0) {
           result.addContent(commentTagsToOutput(null, doc, deprs[0].inlineTags(), false));
         }
       }
     }
   } else {
     MemberDoc member = (MemberDoc) doc;
     if (Util.isDeprecated((ProgramElementDoc) doc)) {
       result.addContent(
           HtmlTree.SPAN(
               HtmlStyle.deprecatedLabel,
               new StringContent(configuration.getText("doclet.Deprecated"))));
       result.addContent(RawHtml.nbsp);
       if (deprs.length > 0) {
         Content body = commentTagsToOutput(null, doc, deprs[0].inlineTags(), false);
         if (!body.isEmpty()) result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
       }
     } else {
       if (Util.isDeprecated(member.containingClass())) {
         result.addContent(
             HtmlTree.SPAN(
                 HtmlStyle.deprecatedLabel,
                 new StringContent(configuration.getText("doclet.Deprecated"))));
         result.addContent(RawHtml.nbsp);
       }
     }
   }
   return result;
 }