Ejemplo n.º 1
0
  /**
   * Given a <code>MethodDoc</code> item, a <code>Tag</code> in the <code>MethodDoc</code> item and
   * a String, replace all occurrences of @inheritDoc with documentation from it's superclass or
   * superinterface.
   *
   * @param writer the writer that is writing the output.
   * @param md the {@link MethodDoc} that we are documenting.
   * @param holderTag the tag that holds the inheritDoc tag.
   * @param isFirstSentence true if we only want to inherit the first sentence.
   */
  private TagletOutput retrieveInheritedDocumentation(
      TagletWriter writer, MethodDoc md, Tag holderTag, boolean isFirstSentence) {
    TagletOutput replacement = writer.getTagletOutputInstance();

    Configuration configuration = writer.configuration();
    Taglet inheritableTaglet =
        holderTag == null ? null : configuration.tagletManager.getTaglet(holderTag.name());
    if (inheritableTaglet != null && !(inheritableTaglet instanceof InheritableTaglet)) {
      // This tag does not support inheritence.
      configuration.message.warning(
          md.position(), "doclet.noInheritedDoc", md.name() + md.flatSignature());
    }
    DocFinder.Output inheritedDoc =
        DocFinder.search(
            new DocFinder.Input(
                md, (InheritableTaglet) inheritableTaglet, holderTag, isFirstSentence, true));
    if (inheritedDoc.isValidInheritDocTag == false) {
      configuration.message.warning(
          md.position(), "doclet.noInheritedDoc", md.name() + md.flatSignature());
    } else if (inheritedDoc.inlineTags.length > 0) {
      replacement =
          writer.commentTagsToOutput(
              inheritedDoc.holderTag,
              inheritedDoc.holder,
              inheritedDoc.inlineTags,
              isFirstSentence);
    }
    return replacement;
  }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 public Content getTagletOutput(Tag tag, TagletWriter writer) {
   ArrayList inlineTags = new ArrayList();
   inlineTags.add(new TextTag(tag.holder(), "<b>"));
   inlineTags.addAll(Arrays.asList(tag.inlineTags()));
   inlineTags.add(new TextTag(tag.holder(), "</b>"));
   return writer.commentTagsToOutput(tag, (Tag[]) inlineTags.toArray(new Tag[] {}));
 }