Exemplo n.º 1
0
 public static void register(Map tagletMap) {
   BoldTaglet tag = new BoldTaglet();
   Taglet t = (Taglet) tagletMap.get(tag.getName());
   if (t != null) {
     tagletMap.remove(tag.getName());
   }
   tagletMap.put(tag.getName(), tag);
 }
Exemplo n.º 2
0
 /** {@inheritDoc} */
 public void inherit(DocFinder.Input input, DocFinder.Output output) {
   if (input.tagId == null) {
     input.isTypeVariableParamTag = ((ParamTag) input.tag).isTypeParameter();
     Object[] parameters =
         input.isTypeVariableParamTag
             ? (Object[]) ((MethodDoc) input.tag.holder()).typeParameters()
             : (Object[]) ((MethodDoc) input.tag.holder()).parameters();
     String target = ((ParamTag) input.tag).parameterName();
     int i;
     for (i = 0; i < parameters.length; i++) {
       String name =
           parameters[i] instanceof Parameter
               ? ((Parameter) parameters[i]).name()
               : ((TypeVariable) parameters[i]).typeName();
       if (name.equals(target)) {
         input.tagId = String.valueOf(i);
         break;
       }
     }
     if (i == parameters.length) {
       // Someone used {@inheritDoc} on an invalid @param tag.
       // We don't know where to inherit from.
       // XXX: in the future when Configuration is available here,
       // print a warning for this mistake.
       return;
     }
   }
   ParamTag[] tags =
       input.isTypeVariableParamTag ? input.method.typeParamTags() : input.method.paramTags();
   Map rankMap =
       getRankMap(
           input.isTypeVariableParamTag
               ? (Object[]) input.method.typeParameters()
               : (Object[]) input.method.parameters());
   for (int i = 0; i < tags.length; i++) {
     if (rankMap.containsKey(tags[i].parameterName())
         && rankMap.get(tags[i].parameterName()).equals((input.tagId))) {
       output.holder = input.method;
       output.holderTag = tags[i];
       output.inlineTags =
           input.isFirstSentence ? tags[i].firstSentenceTags() : tags[i].inlineTags();
       return;
     }
   }
 }
Exemplo n.º 3
0
 /**
  * Given an array of <code>Tag</code>s representing this custom tag, return its string
  * representation. Print a warning for param tags that do not map to parameters. Print a warning
  * for param tags that are duplicated.
  *
  * @param paramTags the array of <code>ParamTag</code>s to convert.
  * @param writer the TagletWriter that will write this tag.
  * @param alreadyDocumented the set of exceptions that have already been documented.
  * @param rankMap a {@link java.util.Map} which holds ordering information about the parameters.
  * @param nameMap a {@link java.util.Map} which holds a mapping of a rank of a parameter to its
  *     name. This is used to ensure that the right name is used when parameter documentation is
  *     inherited.
  * @return the TagletOutput representation of this <code>Tag</code>.
  */
 private TagletOutput processParamTags(
     boolean isNonTypeParams,
     ParamTag[] paramTags,
     Map rankMap,
     TagletWriter writer,
     Set alreadyDocumented) {
   TagletOutput result = writer.getOutputInstance();
   if (paramTags.length > 0) {
     for (int i = 0; i < paramTags.length; ++i) {
       ParamTag pt = paramTags[i];
       String paramName = isNonTypeParams ? pt.parameterName() : "<" + pt.parameterName() + ">";
       if (!rankMap.containsKey(pt.parameterName())) {
         writer
             .getMsgRetriever()
             .warning(
                 pt.position(),
                 isNonTypeParams ? "doclet.Parameters_warn" : "doclet.Type_Parameters_warn",
                 paramName);
       }
       String rank = (String) rankMap.get(pt.parameterName());
       if (rank != null && alreadyDocumented.contains(rank)) {
         writer
             .getMsgRetriever()
             .warning(
                 pt.position(),
                 isNonTypeParams
                     ? "doclet.Parameters_dup_warn"
                     : "doclet.Type_Parameters_dup_warn",
                 paramName);
       }
       result.appendOutput(
           processParamTag(
               isNonTypeParams, writer, pt, pt.parameterName(), alreadyDocumented.size() == 0));
       alreadyDocumented.add(rank);
     }
   }
   return result;
 }
 /**
  * Add the member summary for the given class.
  *
  * @param classDoc the class that is being documented
  * @param member the member being documented
  * @param firstSentenceTags the first sentence tags to be added to the summary
  * @param tableContents the list of contents to which the documentation will be added
  * @param counter the counter for determining id and style for the table row
  */
 public void addMemberSummary(
     ClassDoc classDoc,
     ProgramElementDoc member,
     Tag[] firstSentenceTags,
     List<Content> tableContents,
     int counter) {
   HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
   tdSummaryType.addStyle(HtmlStyle.colFirst);
   writer.addSummaryType(this, member, tdSummaryType);
   HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
   setSummaryColumnStyle(tdSummary);
   addSummaryLink(classDoc, member, tdSummary);
   writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
   HtmlTree tr = HtmlTree.TR(tdSummaryType);
   tr.addContent(tdSummary);
   if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
     int methodType =
         (member.isStatic()) ? MethodTypes.STATIC.value() : MethodTypes.INSTANCE.value();
     if (member.containingClass().isInterface()) {
       methodType =
           (((MethodDoc) member).isAbstract())
               ? methodType | MethodTypes.ABSTRACT.value()
               : methodType | MethodTypes.DEFAULT.value();
     } else {
       methodType =
           (((MethodDoc) member).isAbstract())
               ? methodType | MethodTypes.ABSTRACT.value()
               : methodType | MethodTypes.CONCRETE.value();
     }
     if (utils.isDeprecated(member) || utils.isDeprecated(classdoc)) {
       methodType = methodType | MethodTypes.DEPRECATED.value();
     }
     methodTypesOr = methodTypesOr | methodType;
     String tableId = "i" + counter;
     typeMap.put(tableId, methodType);
     tr.addAttr(HtmlAttr.ID, tableId);
   }
   if (counter % 2 == 0) tr.addStyle(HtmlStyle.altColor);
   else tr.addStyle(HtmlStyle.rowColor);
   tableContents.add(tr);
 }