8011651: simplify LinkInfoImpl API

Tue, 14 May 2013 10:14:52 -0700

author
jjg
date
Tue, 14 May 2013 10:14:52 -0700
changeset 1738
6ea964c78845
parent 1737
7a9ef837e57f
child 1739
e6c5b5ee9fac

8011651: simplify LinkInfoImpl API
Reviewed-by: darcy

src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue May 14 10:14:52 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue May 14 10:14:52 2013 -0700
     1.3 @@ -62,7 +62,7 @@
     1.4       */
     1.5      protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
     1.6          LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
     1.7 -            LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS, member, false);
     1.8 +            LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS, member);
     1.9          Content typeParameters = writer.getTypeParameterLinks(linkInfo);
    1.10          if (linkInfo.displayLength > 0) {
    1.11              Content linkContent = typeParameters;
    1.12 @@ -130,7 +130,7 @@
    1.13          if (param.type() != null) {
    1.14              Content link = writer.getLink(new LinkInfoImpl(
    1.15                      configuration, LinkInfoImpl.Kind.EXECUTABLE_MEMBER_PARAM,
    1.16 -                    param.type(), isVarArg));
    1.17 +                    param.type()).varargs(isVarArg));
    1.18              tree.addContent(link);
    1.19          }
    1.20          if(param.name().length() > 0) {
    1.21 @@ -244,7 +244,7 @@
    1.22          Type[] exceptions = member.thrownExceptionTypes();
    1.23          if(exceptions.length > 0) {
    1.24              LinkInfoImpl memberTypeParam = new LinkInfoImpl(configuration,
    1.25 -                    LinkInfoImpl.Kind.MEMBER, member, false);
    1.26 +                    LinkInfoImpl.Kind.MEMBER, member);
    1.27              int retlen = getReturnTypeLength(member);
    1.28              writer.getTypeParameterLinks(memberTypeParam);
    1.29              retlen += memberTypeParam.displayLength == 0 ?
     2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Tue May 14 10:14:52 2013 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Tue May 14 10:14:52 2013 -0700
     2.3 @@ -140,7 +140,7 @@
     2.4       */
     2.5      protected void addDescription(ClassDoc cd, Content dlTree) {
     2.6          Content link = getLink(new LinkInfoImpl(configuration,
     2.7 -                        LinkInfoImpl.Kind.INDEX, cd, true));
     2.8 +                        LinkInfoImpl.Kind.INDEX, cd).strong(true));
     2.9          Content dt = HtmlTree.DT(link);
    2.10          dt.addContent(" - ");
    2.11          addClassInfo(cd, dt);
     3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Tue May 14 10:14:52 2013 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Tue May 14 10:14:52 2013 -0700
     3.3 @@ -160,9 +160,9 @@
     3.4              Content linkContent;
     3.5              if (wantFrames) {
     3.6                  linkContent = getLink(new LinkInfoImpl(configuration,
     3.7 -                        LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd, label, "classFrame"));
     3.8 +                        LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd).label(label).target("classFrame"));
     3.9              } else {
    3.10 -                linkContent = getLink(new LinkInfoImpl(configuration, cd, label));
    3.11 +                linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, cd).label(label));
    3.12              }
    3.13              Content li = HtmlTree.LI(linkContent);
    3.14              content.addContent(li);
     4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue May 14 10:14:52 2013 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue May 14 10:14:52 2013 -0700
     4.3 @@ -117,8 +117,8 @@
     4.4          Content li;
     4.5          if (prev != null) {
     4.6              Content prevLink = getLink(new LinkInfoImpl(configuration,
     4.7 -                    LinkInfoImpl.Kind.CLASS, prev.asClassDoc(), "",
     4.8 -                    configuration.getText("doclet.Prev_Class"), true));
     4.9 +                    LinkInfoImpl.Kind.CLASS, prev.asClassDoc())
    4.10 +                    .label(configuration.getText("doclet.Prev_Class")).strong(true));
    4.11              li = HtmlTree.LI(prevLink);
    4.12          }
    4.13          else
    4.14 @@ -135,8 +135,8 @@
    4.15          Content li;
    4.16          if (next != null) {
    4.17              Content nextLink = getLink(new LinkInfoImpl(configuration,
    4.18 -                    LinkInfoImpl.Kind.CLASS, next.asClassDoc(), "",
    4.19 -                    configuration.getText("doclet.Next_Class"), true));
    4.20 +                    LinkInfoImpl.Kind.CLASS, next.asClassDoc())
    4.21 +                    .label(configuration.getText("doclet.Next_Class")).strong(true));
    4.22              li = HtmlTree.LI(nextLink);
    4.23          }
    4.24          else
    4.25 @@ -163,7 +163,7 @@
    4.26              div.addContent(pkgNameDiv);
    4.27          }
    4.28          LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
    4.29 -                LinkInfoImpl.Kind.CLASS_HEADER, annotationType, false);
    4.30 +                LinkInfoImpl.Kind.CLASS_HEADER, annotationType);
    4.31          Content headerContent = new StringContent(header);
    4.32          Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
    4.33                  HtmlStyle.title, headerContent);
    4.34 @@ -220,7 +220,7 @@
    4.35          addAnnotationInfo(annotationType, pre);
    4.36          pre.addContent(modifiers);
    4.37          LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
    4.38 -                LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType, false);
    4.39 +                LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType);
    4.40          Content annotationName = new StringContent(annotationType.name());
    4.41          Content parameterLinks = getTypeParameterLinks(linkInfo);
    4.42          if (configuration.linksource) {
     5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Tue May 14 10:14:52 2013 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Tue May 14 10:14:52 2013 -0700
     5.3 @@ -258,8 +258,8 @@
     5.4          Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
     5.5                  getTableCaption(configuration.getText(
     5.6                  "doclet.ClassUse_Packages.that.use.0",
     5.7 -                getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc,
     5.8 -                false)).toString())));
     5.9 +                getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc
    5.10 +                )).toString())));
    5.11          table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
    5.12          Content tbody = new HtmlTree(HtmlTag.TBODY);
    5.13          Iterator<PackageDoc> it = pkgSet.iterator();
    5.14 @@ -294,7 +294,7 @@
    5.15                  getTableCaption(configuration.getText(
    5.16                  "doclet.ClassUse_PackageAnnotation",
    5.17                  getLink(new LinkInfoImpl(configuration,
    5.18 -                        LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, false)).toString())));
    5.19 +                        LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)).toString())));
    5.20          table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
    5.21          Content tbody = new HtmlTree(HtmlTag.TBODY);
    5.22          Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
    5.23 @@ -334,7 +334,7 @@
    5.24              Content link = new RawHtml(
    5.25                      configuration.getText("doclet.ClassUse_Uses.of.0.in.1",
    5.26                      getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
    5.27 -                    classdoc, false)).toString(),
    5.28 +                    classdoc)).toString(),
    5.29                      getPackageLinkString(pkg, Util.escapeHtmlChars(Util.getPackageName(pkg)), false)));
    5.30              Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
    5.31              li.addContent(heading);
    5.32 @@ -369,7 +369,7 @@
    5.33       */
    5.34      protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
    5.35          String classLink = getLink(new LinkInfoImpl(configuration,
    5.36 -            LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, false)).toString();
    5.37 +            LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)).toString();
    5.38          String pkgLink = getPackageLinkString(pkg, Util.escapeHtmlChars(Util.getPackageName(pkg)), false);
    5.39          classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
    5.40                  configuration.getText("doclet.ClassUse_Annotation", classLink,
    5.41 @@ -477,8 +477,8 @@
    5.42       */
    5.43      protected Content getNavLinkClass() {
    5.44          Content linkContent = getLink(new LinkInfoImpl(
    5.45 -                configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc,
    5.46 -                "", configuration.getText("doclet.Class"), false));
    5.47 +                configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)
    5.48 +                .label(configuration.getText("doclet.Class")));
    5.49          Content li = HtmlTree.LI(linkContent);
    5.50          return li;
    5.51      }
     6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Tue May 14 10:14:52 2013 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Tue May 14 10:14:52 2013 -0700
     6.3 @@ -125,8 +125,8 @@
     6.4          Content li;
     6.5          if (prev != null) {
     6.6              Content prevLink = getLink(new LinkInfoImpl(configuration,
     6.7 -                    LinkInfoImpl.Kind.CLASS, prev, "",
     6.8 -                    configuration.getText("doclet.Prev_Class"), true));
     6.9 +                    LinkInfoImpl.Kind.CLASS, prev)
    6.10 +                    .label(configuration.getText("doclet.Prev_Class")).strong(true));
    6.11              li = HtmlTree.LI(prevLink);
    6.12          }
    6.13          else
    6.14 @@ -143,8 +143,8 @@
    6.15          Content li;
    6.16          if (next != null) {
    6.17              Content nextLink = getLink(new LinkInfoImpl(configuration,
    6.18 -                    LinkInfoImpl.Kind.CLASS, next, "",
    6.19 -                    configuration.getText("doclet.Next_Class"), true));
    6.20 +                    LinkInfoImpl.Kind.CLASS, next)
    6.21 +                    .label(configuration.getText("doclet.Next_Class")).strong(true));
    6.22              li = HtmlTree.LI(nextLink);
    6.23          }
    6.24          else
    6.25 @@ -185,7 +185,7 @@
    6.26              div.addContent(pkgNameDiv);
    6.27          }
    6.28          LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
    6.29 -                LinkInfoImpl.Kind.CLASS_HEADER, classDoc, false);
    6.30 +                LinkInfoImpl.Kind.CLASS_HEADER, classDoc);
    6.31          //Let's not link to ourselves in the header.
    6.32          linkInfo.linkToSelf = false;
    6.33          Content headerContent = new StringContent(header);
    6.34 @@ -245,7 +245,7 @@
    6.35          addAnnotationInfo(classDoc, pre);
    6.36          pre.addContent(modifiers);
    6.37          LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
    6.38 -                LinkInfoImpl.Kind.CLASS_SIGNATURE, classDoc, false);
    6.39 +                LinkInfoImpl.Kind.CLASS_SIGNATURE, classDoc);
    6.40          //Let's not link to ourselves in the signature.
    6.41          linkInfo.linkToSelf = false;
    6.42          Content className = new StringContent(classDoc.name());
    6.43 @@ -362,7 +362,7 @@
    6.44          if (type.equals(classDoc)) {
    6.45              Content typeParameters = getTypeParameterLinks(
    6.46                      new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
    6.47 -                    classDoc, false));
    6.48 +                    classDoc));
    6.49              if (configuration.shouldExcludeQualifier(
    6.50                      classDoc.containingPackage().name())) {
    6.51                  li.addContent(type.asClassDoc().name());
    6.52 @@ -373,9 +373,8 @@
    6.53              }
    6.54          } else {
    6.55              Content link = getLink(new LinkInfoImpl(configuration,
    6.56 -                    LinkInfoImpl.Kind.CLASS_TREE_PARENT,
    6.57 -                    type instanceof ClassDoc ? (ClassDoc) type : type,
    6.58 -                    configuration.getClassName(type.asClassDoc()), false));
    6.59 +                    LinkInfoImpl.Kind.CLASS_TREE_PARENT, type)
    6.60 +                    .label(configuration.getClassName(type.asClassDoc())));
    6.61              li.addContent(link);
    6.62          }
    6.63          return li;
    6.64 @@ -521,7 +520,7 @@
    6.65              Content dl = HtmlTree.DL(dt);
    6.66              Content dd = new HtmlTree(HtmlTag.DD);
    6.67              dd.addContent(getLink(new LinkInfoImpl(configuration,
    6.68 -                    LinkInfoImpl.Kind.CLASS, outerClass, false)));
    6.69 +                    LinkInfoImpl.Kind.CLASS, outerClass)));
    6.70              dl.addContent(dd);
    6.71              classInfoTree.addContent(dl);
    6.72          }
     7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Tue May 14 10:14:52 2013 -0700
     7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Tue May 14 10:14:52 2013 -0700
     7.3 @@ -186,7 +186,7 @@
     7.4          //generate links backward only to public classes.
     7.5          String classlink = (cd.isPublic() || cd.isProtected()) ?
     7.6              getLink(new LinkInfoImpl(configuration,
     7.7 -                    LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd, false)).toString() :
     7.8 +                    LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd)).toString() :
     7.9              cd.qualifiedName();
    7.10          String name = cd.containingPackage().name();
    7.11          if (name.length() > 0) {
     8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:52 2013 -0700
     8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:52 2013 -0700
     8.3 @@ -373,8 +373,7 @@
     8.4                      continue;
     8.5                  }
     8.6                  Content classContent = getLink(new LinkInfoImpl(
     8.7 -                        configuration, LinkInfoImpl.Kind.PACKAGE, classes[i],
     8.8 -                        false));
     8.9 +                        configuration, LinkInfoImpl.Kind.PACKAGE, classes[i]));
    8.10                  Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
    8.11                  HtmlTree tr = HtmlTree.TR(tdClass);
    8.12                  if (i%2 == 0)
    8.13 @@ -1192,8 +1191,8 @@
    8.14       * @return a content tree for the link
    8.15       */
    8.16      public Content getQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd) {
    8.17 -        return getLink(new LinkInfoImpl(configuration, context, cd,
    8.18 -                new StringContent(configuration.getClassName(cd)), ""));
    8.19 +        return getLink(new LinkInfoImpl(configuration, context, cd)
    8.20 +                .label(configuration.getClassName(cd)));
    8.21      }
    8.22  
    8.23      /**
    8.24 @@ -1224,7 +1223,7 @@
    8.25              classlink.addContent(getPkgName(cd));
    8.26          }
    8.27          classlink.addContent(getLink(new LinkInfoImpl(configuration,
    8.28 -                context, cd, cd.name(), isStrong)));
    8.29 +                context, cd).label(cd.name()).strong(isStrong)));
    8.30          return classlink;
    8.31      }
    8.32  
    8.33 @@ -1245,7 +1244,7 @@
    8.34              contentTree.addContent(getPkgName(cd));
    8.35          }
    8.36          contentTree.addContent(getLink(new LinkInfoImpl(configuration,
    8.37 -                context, cd, cd.name(), isStrong)));
    8.38 +                context, cd).label(cd.name()).strong(isStrong)));
    8.39      }
    8.40  
    8.41      /**
    8.42 @@ -1329,11 +1328,11 @@
    8.43              return label;
    8.44          } else if (doc instanceof ExecutableMemberDoc) {
    8.45              ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
    8.46 -            return getLink(new LinkInfoImpl(configuration, context, classDoc,
    8.47 -                getAnchor(emd, isProperty), label, strong));
    8.48 +            return getLink(new LinkInfoImpl(configuration, context, classDoc)
    8.49 +                .label(label).where(getAnchor(emd, isProperty)).strong(strong));
    8.50          } else if (doc instanceof MemberDoc) {
    8.51 -            return getLink(new LinkInfoImpl(configuration, context, classDoc,
    8.52 -                doc.name(), label, strong));
    8.53 +            return getLink(new LinkInfoImpl(configuration, context, classDoc)
    8.54 +                .label(label).where(doc.name()).strong(strong));
    8.55          } else {
    8.56              return label;
    8.57          }
    8.58 @@ -1356,12 +1355,12 @@
    8.59              Util.isLinkable(classDoc, configuration))) {
    8.60              return label;
    8.61          } else if (doc instanceof ExecutableMemberDoc) {
    8.62 -            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
    8.63 -            return getLink(new LinkInfoImpl(configuration, context, classDoc,
    8.64 -                getAnchor(emd), label, false));
    8.65 +            ExecutableMemberDoc emd = (ExecutableMemberDoc) doc;
    8.66 +            return getLink(new LinkInfoImpl(configuration, context, classDoc)
    8.67 +                .label(label).where(getAnchor(emd)));
    8.68          } else if (doc instanceof MemberDoc) {
    8.69 -            return getLink(new LinkInfoImpl(configuration, context, classDoc,
    8.70 -                doc.name(), label, false));
    8.71 +            return getLink(new LinkInfoImpl(configuration, context, classDoc)
    8.72 +                .label(label).where(doc.name()));
    8.73          } else {
    8.74              return label;
    8.75          }
    8.76 @@ -1447,7 +1446,8 @@
    8.77              if (label.isEmpty()) {
    8.78                  label = plainOrCode(plain, new StringContent(refClass.name()));
    8.79              }
    8.80 -            return getLink(new LinkInfoImpl(configuration, refClass, label)).toString();
    8.81 +            return getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, refClass)
    8.82 +                    .label(label)).toString();
    8.83          } else if (refMem == null) {
    8.84              // Must be a member reference since refClass is not null and refMemName is not null.
    8.85              // However, refMem is null, so this referenced member does not exist.
     9.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Tue May 14 10:14:52 2013 -0700
     9.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Tue May 14 10:14:52 2013 -0700
     9.3 @@ -237,16 +237,13 @@
     9.4       *
     9.5       * @param configuration the configuration data for the doclet
     9.6       * @param context    the context of the link.
     9.7 -     * @param classDoc   the class to link to.
     9.8 -     * @param label      the label for the link.
     9.9 -     * @param target     the value of the target attribute.
    9.10 +     * @param context               the context of the link.
    9.11 +     * @param executableMemberDoc   the member to link to.
    9.12       */
    9.13      public LinkInfoImpl(ConfigurationImpl configuration,
    9.14 -            Kind context, ClassDoc classDoc, Content label, String target) {
    9.15 +            Kind context, ExecutableMemberDoc executableMemberDoc) {
    9.16          this.configuration = configuration;
    9.17 -        this.classDoc = classDoc;
    9.18 -        this.label = label;
    9.19 -        this.target = target;
    9.20 +        this.executableMemberDoc = executableMemberDoc;
    9.21          setContext(context);
    9.22      }
    9.23  
    9.24 @@ -263,117 +260,11 @@
    9.25       * @param configuration the configuration data for the doclet
    9.26       * @param context    the context of the link.
    9.27       * @param classDoc   the class to link to.
    9.28 -     * @param where      the value of the marker #.
    9.29 -     * @param label      the label for the link.
    9.30 -     * @param isStrong       true if the link should be strong.
    9.31 -     * @param styleName  String style of text defined in style sheet.
    9.32       */
    9.33      public LinkInfoImpl(ConfigurationImpl configuration,
    9.34 -            Kind context, ClassDoc classDoc, String where, Content label,
    9.35 -            boolean isStrong, String styleName) {
    9.36 +            Kind context, ClassDoc classDoc) {
    9.37          this.configuration = configuration;
    9.38          this.classDoc = classDoc;
    9.39 -        this.where = where;
    9.40 -        this.label = label;
    9.41 -        this.isStrong = isStrong;
    9.42 -        this.styleName = styleName;
    9.43 -        setContext(context);
    9.44 -    }
    9.45 -
    9.46 -    /**
    9.47 -     * Construct a LinkInfo object.
    9.48 -     *
    9.49 -     * @param configuration the configuration data for the doclet
    9.50 -     * @param context    the context of the link.
    9.51 -     * @param classDoc   the class to link to.
    9.52 -     * @param where      the value of the marker #.
    9.53 -     * @param label      the plain-text label for the link.
    9.54 -     * @param isStrong       true if the link should be strong.
    9.55 -     */
    9.56 -    public LinkInfoImpl(ConfigurationImpl configuration,
    9.57 -            Kind context, ClassDoc classDoc, String where, String label,
    9.58 -            boolean isStrong) {
    9.59 -        this(configuration, context, classDoc, where, new StringContent(label),
    9.60 -                isStrong, "");
    9.61 -    }
    9.62 -
    9.63 -    /**
    9.64 -     * Construct a LinkInfo object.
    9.65 -     *
    9.66 -     * @param configuration the configuration data for the doclet
    9.67 -     * @param context    the context of the link.
    9.68 -     * @param classDoc   the class to link to.
    9.69 -     * @param where      the value of the marker #.
    9.70 -     * @param label      the label for the link.
    9.71 -     * @param isStrong       true if the link should be strong.
    9.72 -     */
    9.73 -    public LinkInfoImpl(ConfigurationImpl configuration,
    9.74 -            Kind context, ClassDoc classDoc, String where, Content label,
    9.75 -            boolean isStrong) {
    9.76 -        this(configuration, context, classDoc, where, label,
    9.77 -                isStrong, "");
    9.78 -    }
    9.79 -
    9.80 -    /**
    9.81 -     * Construct a LinkInfo object.
    9.82 -     *
    9.83 -     * @param configuration the configuration data for the doclet
    9.84 -     * @param classDoc   the class to link to.
    9.85 -     * @param label      the label for the link.
    9.86 -     */
    9.87 -    public LinkInfoImpl(ConfigurationImpl configuration,
    9.88 -            ClassDoc classDoc, Content label) {
    9.89 -        this.configuration = configuration;
    9.90 -        this.classDoc = classDoc;
    9.91 -        this.label = label;
    9.92 -        setContext(context);
    9.93 -    }
    9.94 -
    9.95 -    /**
    9.96 -     * Construct a LinkInfo object.
    9.97 -     *
    9.98 -     * @param configuration the configuration data for the doclet
    9.99 -     * @param classDoc   the class to link to.
   9.100 -     * @param label      the label for the link.
   9.101 -     */
   9.102 -    public LinkInfoImpl(ConfigurationImpl configuration,
   9.103 -            ClassDoc classDoc, String label) {
   9.104 -        this.configuration = configuration;
   9.105 -        this.classDoc = classDoc;
   9.106 -        this.label = new StringContent(label);
   9.107 -        setContext(context);
   9.108 -    }
   9.109 -
   9.110 -    /**
   9.111 -     * Construct a LinkInfo object.
   9.112 -     *
   9.113 -     * @param configuration the configuration data for the doclet
   9.114 -     * @param context               the context of the link.
   9.115 -     * @param executableMemberDoc   the member to link to.
   9.116 -     * @param isStrong                true if the link should be strong.
   9.117 -     */
   9.118 -    public LinkInfoImpl(ConfigurationImpl configuration,
   9.119 -            Kind context, ExecutableMemberDoc executableMemberDoc,
   9.120 -            boolean isStrong) {
   9.121 -        this.configuration = configuration;
   9.122 -        this.executableMemberDoc = executableMemberDoc;
   9.123 -        this.isStrong = isStrong;
   9.124 -        setContext(context);
   9.125 -    }
   9.126 -
   9.127 -    /**
   9.128 -     * Construct a LinkInfo object.
   9.129 -     *
   9.130 -     * @param configuration the configuration data for the doclet
   9.131 -     * @param context    the context of the link.
   9.132 -     * @param classDoc   the class to link to.
   9.133 -     * @param isStrong       true if the link should be strong.
   9.134 -     */
   9.135 -    public LinkInfoImpl(ConfigurationImpl configuration,
   9.136 -            Kind context, ClassDoc classDoc,  boolean isStrong) {
   9.137 -        this.configuration = configuration;
   9.138 -        this.classDoc = classDoc;
   9.139 -        this.isStrong = isStrong;
   9.140          setContext(context);
   9.141      }
   9.142  
   9.143 @@ -391,91 +282,67 @@
   9.144          setContext(context);
   9.145      }
   9.146  
   9.147 +
   9.148      /**
   9.149 -     * Construct a LinkInfo object.
   9.150 -     *
   9.151 -     * @param configuration the configuration data for the doclet
   9.152 -     * @param context    the context of the link.
   9.153 -     * @param type       the class to link to.
   9.154 -     * @param isVarArg   true if this is a link to a var arg.
   9.155 +     * Set the label for the link.
   9.156 +     * @param label plain-text label for the link
   9.157       */
   9.158 -    public LinkInfoImpl(ConfigurationImpl configuration,
   9.159 -            Kind context, Type type, boolean isVarArg) {
   9.160 -        this.configuration = configuration;
   9.161 -        this.type = type;
   9.162 -        this.isVarArg = isVarArg;
   9.163 -        setContext(context);
   9.164 +    public LinkInfoImpl label(String label) {
   9.165 +        this.label = new StringContent(label);
   9.166 +        return this;
   9.167      }
   9.168  
   9.169      /**
   9.170 -     * Construct a LinkInfo object.
   9.171 -     *
   9.172 -     * @param configuration the configuration data for the doclet
   9.173 -     * @param context    the context of the link.
   9.174 -     * @param type       the class to link to.
   9.175 -     * @param label      plain-text label for the link.
   9.176 -     * @param isStrong     true if the link should be strong.
   9.177 +     * Set the label for the link.
   9.178       */
   9.179 -    public LinkInfoImpl(ConfigurationImpl configuration,
   9.180 -            Kind context, Type type, String label,
   9.181 -            boolean isStrong) {
   9.182 -        this(configuration, context, type, new StringContent(label), isStrong);
   9.183 +    public LinkInfoImpl label(Content label) {
   9.184 +        this.label = label;
   9.185 +        return this;
   9.186      }
   9.187  
   9.188      /**
   9.189 -     * Construct a LinkInfo object.
   9.190 -     *
   9.191 -     * @param configuration the configuration data for the doclet
   9.192 -     * @param context    the context of the link.
   9.193 -     * @param type       the class to link to.
   9.194 -     * @param label      the label for the link.
   9.195 -     * @param isStrong     true if the link should be strong.
   9.196 +     * Set whether or not the link should be strong.
   9.197       */
   9.198 -    public LinkInfoImpl(ConfigurationImpl configuration,
   9.199 -            Kind context, Type type, Content label,
   9.200 -            boolean isStrong) {
   9.201 -        this.configuration = configuration;
   9.202 -        this.type = type;
   9.203 -        this.label = label;
   9.204 -        this.isStrong = isStrong;
   9.205 -        setContext(context);
   9.206 +    public LinkInfoImpl strong(boolean strong) {
   9.207 +        this.isStrong = strong;
   9.208 +        return this;
   9.209      }
   9.210  
   9.211      /**
   9.212 -     * Construct a LinkInfo object.
   9.213 -     *
   9.214 -     * @param configuration the configuration data for the doclet
   9.215 -     * @param context    the context of the link.
   9.216 -     * @param classDoc   the class to link to.
   9.217 -     * @param label      plain-text label for the link.
   9.218 -     * @param isStrong       true if the link should be strong.
   9.219 +     * Set the style to be used for the link.
   9.220 +     * @param styleName  String style of text defined in style sheet.
   9.221       */
   9.222 -    public LinkInfoImpl(ConfigurationImpl configuration,
   9.223 -            Kind context, ClassDoc classDoc, String label,
   9.224 -            boolean isStrong) {
   9.225 -        this(configuration, context, classDoc, new StringContent(label), isStrong);
   9.226 +    public LinkInfoImpl styleName(String styleName) {
   9.227 +        this.styleName = styleName;
   9.228 +        return this;
   9.229      }
   9.230  
   9.231      /**
   9.232 -     * Construct a LinkInfo object.
   9.233 -     *
   9.234 -     * @param configuration the configuration data for the doclet
   9.235 -     * @param context    the context of the link.
   9.236 -     * @param classDoc   the class to link to.
   9.237 -     * @param label      the label for the link.
   9.238 -     * @param isStrong       true if the link should be strong.
   9.239 +     * Set the target to be used for the link.
   9.240 +     * @param styleName  String style of text defined in style sheet.
   9.241       */
   9.242 -    public LinkInfoImpl(ConfigurationImpl configuration,
   9.243 -            Kind context, ClassDoc classDoc, Content label,
   9.244 -            boolean isStrong) {
   9.245 -        this.configuration = configuration;
   9.246 -        this.classDoc = classDoc;
   9.247 -        this.label = label;
   9.248 -        this.isStrong = isStrong;
   9.249 -        setContext(context);
   9.250 +    public LinkInfoImpl target(String target) {
   9.251 +        this.target = target;
   9.252 +        return this;
   9.253      }
   9.254  
   9.255      /**
   9.256 +     * Set whether or not this is a link to a varargs parameter.
   9.257 +     */
   9.258 +    public LinkInfoImpl varargs(boolean varargs) {
   9.259 +        this.isVarArg = varargs;
   9.260 +        return this;
   9.261 +    }
   9.262 +
   9.263 +    /**
   9.264 +     * Set the fragment specifier for the link.
   9.265 +     */
   9.266 +    public LinkInfoImpl where(String where) {
   9.267 +        this.where = where;
   9.268 +        return this;
   9.269 +     }
   9.270 +
   9.271 +    /**
   9.272       * {@inheritDoc}
   9.273       */
   9.274      public Kind getContext() {
   9.275 @@ -546,7 +413,7 @@
   9.276          context = c;
   9.277          if (type != null &&
   9.278              type.asTypeVariable()!= null &&
   9.279 -            type.asTypeVariable().owner() instanceof ExecutableMemberDoc){
   9.280 +            type.asTypeVariable().owner() instanceof ExecutableMemberDoc) {
   9.281              excludeTypeParameterLinks = true;
   9.282          }
   9.283      }
    10.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue May 14 10:14:52 2013 -0700
    10.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue May 14 10:14:52 2013 -0700
    10.3 @@ -317,8 +317,8 @@
    10.4              String name = method.name();
    10.5              Content methlink = writer.getLink(
    10.6                      new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
    10.7 -                    overriddenType.asClassDoc(),
    10.8 -                    writer.getAnchor(method), name, false));
    10.9 +                    overriddenType.asClassDoc())
   10.10 +                    .where(writer.getAnchor(method)).label(name));
   10.11              Content codeMethLink = HtmlTree.CODE(methlink);
   10.12              Content dd = HtmlTree.DD(codeMethLink);
   10.13              dd.addContent(writer.getSpace());
    11.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java	Tue May 14 10:14:52 2013 -0700
    11.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java	Tue May 14 10:14:52 2013 -0700
    11.3 @@ -165,7 +165,7 @@
    11.4      protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
    11.5              Content tdSummary) {
    11.6          Content strong = HtmlTree.STRONG(
    11.7 -                writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member, false)));
    11.8 +                writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member)));
    11.9          Content code = HtmlTree.CODE(strong);
   11.10          tdSummary.addContent(code);
   11.11      }
   11.12 @@ -177,7 +177,7 @@
   11.13              ProgramElementDoc member, Content linksTree) {
   11.14          linksTree.addContent(
   11.15                  writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
   11.16 -                (ClassDoc)member, false)));
   11.17 +                (ClassDoc)member)));
   11.18      }
   11.19  
   11.20      /**
    12.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue May 14 10:14:52 2013 -0700
    12.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue May 14 10:14:52 2013 -0700
    12.3 @@ -185,7 +185,7 @@
    12.4                  Content arr_i_name = new StringContent(arr[i].name());
    12.5                  if (arr[i].isInterface()) arr_i_name = HtmlTree.I(arr_i_name);
    12.6                  Content link = getLink(new LinkInfoImpl(configuration,
    12.7 -                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i], arr_i_name, "classFrame"));
    12.8 +                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
    12.9                  Content li = HtmlTree.LI(link);
   12.10                  ul.addContent(li);
   12.11              }
    13.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Tue May 14 10:14:52 2013 -0700
    13.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Tue May 14 10:14:52 2013 -0700
    13.3 @@ -179,8 +179,7 @@
    13.4                      continue;
    13.5                  }
    13.6                  Content classContent = getLink(new LinkInfoImpl(
    13.7 -                        configuration, LinkInfoImpl.Kind.PACKAGE, classes[i],
    13.8 -                        false));
    13.9 +                        configuration, LinkInfoImpl.Kind.PACKAGE, classes[i]));
   13.10                  Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
   13.11                  HtmlTree tr = HtmlTree.TR(tdClass);
   13.12                  if (i%2 == 0)
    14.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Tue May 14 10:14:52 2013 -0700
    14.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Tue May 14 10:14:52 2013 -0700
    14.3 @@ -176,7 +176,7 @@
    14.4                  Content arr_i_name = new StringContent(arr[i].name());
    14.5                  if (arr[i].isInterface()) arr_i_name = HtmlTree.I(arr_i_name);
    14.6                  Content link = getLink(new LinkInfoImpl(configuration,
    14.7 -                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i], arr_i_name, "classFrame"));
    14.8 +                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
    14.9                  Content li = HtmlTree.LI(link);
   14.10                  ul.addContent(li);
   14.11              }
    15.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Tue May 14 10:14:52 2013 -0700
    15.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Tue May 14 10:14:52 2013 -0700
    15.3 @@ -128,8 +128,8 @@
    15.4       */
    15.5      public Content getClassHeader(ClassDoc classDoc) {
    15.6          Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ?
    15.7 -            getLink(new LinkInfoImpl(configuration, classDoc,
    15.8 -            configuration.getClassName(classDoc))) :
    15.9 +            getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc)
   15.10 +            .label(configuration.getClassName(classDoc))) :
   15.11              new StringContent(classDoc.qualifiedName());
   15.12          Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
   15.13                  classDoc.qualifiedName()));

mercurial