8011651: simplify LinkInfoImpl API
authorjjg
Tue, 14 May 2013 10:14:52 -0700
changeset 17561 9f3505f35da9
parent 17560 9f6771abbd1a
child 17562 c84f1d7fa11d
8011651: simplify LinkInfoImpl API Reviewed-by: darcy
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue May 14 10:14:52 2013 -0700
@@ -62,7 +62,7 @@
      */
     protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
-            LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS, member, false);
+            LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS, member);
         Content typeParameters = writer.getTypeParameterLinks(linkInfo);
         if (linkInfo.displayLength > 0) {
             Content linkContent = typeParameters;
@@ -130,7 +130,7 @@
         if (param.type() != null) {
             Content link = writer.getLink(new LinkInfoImpl(
                     configuration, LinkInfoImpl.Kind.EXECUTABLE_MEMBER_PARAM,
-                    param.type(), isVarArg));
+                    param.type()).varargs(isVarArg));
             tree.addContent(link);
         }
         if(param.name().length() > 0) {
@@ -244,7 +244,7 @@
         Type[] exceptions = member.thrownExceptionTypes();
         if(exceptions.length > 0) {
             LinkInfoImpl memberTypeParam = new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.MEMBER, member, false);
+                    LinkInfoImpl.Kind.MEMBER, member);
             int retlen = getReturnTypeLength(member);
             writer.getTypeParameterLinks(memberTypeParam);
             retlen += memberTypeParam.displayLength == 0 ?
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Tue May 14 10:14:52 2013 -0700
@@ -140,7 +140,7 @@
      */
     protected void addDescription(ClassDoc cd, Content dlTree) {
         Content link = getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.INDEX, cd, true));
+                        LinkInfoImpl.Kind.INDEX, cd).strong(true));
         Content dt = HtmlTree.DT(link);
         dt.addContent(" - ");
         addClassInfo(cd, dt);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Tue May 14 10:14:52 2013 -0700
@@ -160,9 +160,9 @@
             Content linkContent;
             if (wantFrames) {
                 linkContent = getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd, label, "classFrame"));
+                        LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd).label(label).target("classFrame"));
             } else {
-                linkContent = getLink(new LinkInfoImpl(configuration, cd, label));
+                linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, cd).label(label));
             }
             Content li = HtmlTree.LI(linkContent);
             content.addContent(li);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue May 14 10:14:52 2013 -0700
@@ -117,8 +117,8 @@
         Content li;
         if (prev != null) {
             Content prevLink = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, prev.asClassDoc(), "",
-                    configuration.getText("doclet.Prev_Class"), true));
+                    LinkInfoImpl.Kind.CLASS, prev.asClassDoc())
+                    .label(configuration.getText("doclet.Prev_Class")).strong(true));
             li = HtmlTree.LI(prevLink);
         }
         else
@@ -135,8 +135,8 @@
         Content li;
         if (next != null) {
             Content nextLink = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, next.asClassDoc(), "",
-                    configuration.getText("doclet.Next_Class"), true));
+                    LinkInfoImpl.Kind.CLASS, next.asClassDoc())
+                    .label(configuration.getText("doclet.Next_Class")).strong(true));
             li = HtmlTree.LI(nextLink);
         }
         else
@@ -163,7 +163,7 @@
             div.addContent(pkgNameDiv);
         }
         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
-                LinkInfoImpl.Kind.CLASS_HEADER, annotationType, false);
+                LinkInfoImpl.Kind.CLASS_HEADER, annotationType);
         Content headerContent = new StringContent(header);
         Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
                 HtmlStyle.title, headerContent);
@@ -220,7 +220,7 @@
         addAnnotationInfo(annotationType, pre);
         pre.addContent(modifiers);
         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
-                LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType, false);
+                LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType);
         Content annotationName = new StringContent(annotationType.name());
         Content parameterLinks = getTypeParameterLinks(linkInfo);
         if (configuration.linksource) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Tue May 14 10:14:52 2013 -0700
@@ -258,8 +258,8 @@
         Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
                 getTableCaption(configuration.getText(
                 "doclet.ClassUse_Packages.that.use.0",
-                getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc,
-                false)).toString())));
+                getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc
+                )).toString())));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator<PackageDoc> it = pkgSet.iterator();
@@ -294,7 +294,7 @@
                 getTableCaption(configuration.getText(
                 "doclet.ClassUse_PackageAnnotation",
                 getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, false)).toString())));
+                        LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)).toString())));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
@@ -334,7 +334,7 @@
             Content link = new RawHtml(
                     configuration.getText("doclet.ClassUse_Uses.of.0.in.1",
                     getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
-                    classdoc, false)).toString(),
+                    classdoc)).toString(),
                     getPackageLinkString(pkg, Util.escapeHtmlChars(Util.getPackageName(pkg)), false)));
             Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
             li.addContent(heading);
@@ -369,7 +369,7 @@
      */
     protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
         String classLink = getLink(new LinkInfoImpl(configuration,
-            LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, false)).toString();
+            LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)).toString();
         String pkgLink = getPackageLinkString(pkg, Util.escapeHtmlChars(Util.getPackageName(pkg)), false);
         classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
                 configuration.getText("doclet.ClassUse_Annotation", classLink,
@@ -477,8 +477,8 @@
      */
     protected Content getNavLinkClass() {
         Content linkContent = getLink(new LinkInfoImpl(
-                configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc,
-                "", configuration.getText("doclet.Class"), false));
+                configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)
+                .label(configuration.getText("doclet.Class")));
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Tue May 14 10:14:52 2013 -0700
@@ -125,8 +125,8 @@
         Content li;
         if (prev != null) {
             Content prevLink = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, prev, "",
-                    configuration.getText("doclet.Prev_Class"), true));
+                    LinkInfoImpl.Kind.CLASS, prev)
+                    .label(configuration.getText("doclet.Prev_Class")).strong(true));
             li = HtmlTree.LI(prevLink);
         }
         else
@@ -143,8 +143,8 @@
         Content li;
         if (next != null) {
             Content nextLink = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, next, "",
-                    configuration.getText("doclet.Next_Class"), true));
+                    LinkInfoImpl.Kind.CLASS, next)
+                    .label(configuration.getText("doclet.Next_Class")).strong(true));
             li = HtmlTree.LI(nextLink);
         }
         else
@@ -185,7 +185,7 @@
             div.addContent(pkgNameDiv);
         }
         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
-                LinkInfoImpl.Kind.CLASS_HEADER, classDoc, false);
+                LinkInfoImpl.Kind.CLASS_HEADER, classDoc);
         //Let's not link to ourselves in the header.
         linkInfo.linkToSelf = false;
         Content headerContent = new StringContent(header);
@@ -245,7 +245,7 @@
         addAnnotationInfo(classDoc, pre);
         pre.addContent(modifiers);
         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
-                LinkInfoImpl.Kind.CLASS_SIGNATURE, classDoc, false);
+                LinkInfoImpl.Kind.CLASS_SIGNATURE, classDoc);
         //Let's not link to ourselves in the signature.
         linkInfo.linkToSelf = false;
         Content className = new StringContent(classDoc.name());
@@ -362,7 +362,7 @@
         if (type.equals(classDoc)) {
             Content typeParameters = getTypeParameterLinks(
                     new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
-                    classDoc, false));
+                    classDoc));
             if (configuration.shouldExcludeQualifier(
                     classDoc.containingPackage().name())) {
                 li.addContent(type.asClassDoc().name());
@@ -373,9 +373,8 @@
             }
         } else {
             Content link = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS_TREE_PARENT,
-                    type instanceof ClassDoc ? (ClassDoc) type : type,
-                    configuration.getClassName(type.asClassDoc()), false));
+                    LinkInfoImpl.Kind.CLASS_TREE_PARENT, type)
+                    .label(configuration.getClassName(type.asClassDoc())));
             li.addContent(link);
         }
         return li;
@@ -521,7 +520,7 @@
             Content dl = HtmlTree.DL(dt);
             Content dd = new HtmlTree(HtmlTag.DD);
             dd.addContent(getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, outerClass, false)));
+                    LinkInfoImpl.Kind.CLASS, outerClass)));
             dl.addContent(dd);
             classInfoTree.addContent(dl);
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Tue May 14 10:14:52 2013 -0700
@@ -186,7 +186,7 @@
         //generate links backward only to public classes.
         String classlink = (cd.isPublic() || cd.isProtected()) ?
             getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd, false)).toString() :
+                    LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd)).toString() :
             cd.qualifiedName();
         String name = cd.containingPackage().name();
         if (name.length() > 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:52 2013 -0700
@@ -373,8 +373,7 @@
                     continue;
                 }
                 Content classContent = getLink(new LinkInfoImpl(
-                        configuration, LinkInfoImpl.Kind.PACKAGE, classes[i],
-                        false));
+                        configuration, LinkInfoImpl.Kind.PACKAGE, classes[i]));
                 Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
                 HtmlTree tr = HtmlTree.TR(tdClass);
                 if (i%2 == 0)
@@ -1192,8 +1191,8 @@
      * @return a content tree for the link
      */
     public Content getQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd) {
-        return getLink(new LinkInfoImpl(configuration, context, cd,
-                new StringContent(configuration.getClassName(cd)), ""));
+        return getLink(new LinkInfoImpl(configuration, context, cd)
+                .label(configuration.getClassName(cd)));
     }
 
     /**
@@ -1224,7 +1223,7 @@
             classlink.addContent(getPkgName(cd));
         }
         classlink.addContent(getLink(new LinkInfoImpl(configuration,
-                context, cd, cd.name(), isStrong)));
+                context, cd).label(cd.name()).strong(isStrong)));
         return classlink;
     }
 
@@ -1245,7 +1244,7 @@
             contentTree.addContent(getPkgName(cd));
         }
         contentTree.addContent(getLink(new LinkInfoImpl(configuration,
-                context, cd, cd.name(), isStrong)));
+                context, cd).label(cd.name()).strong(isStrong)));
     }
 
     /**
@@ -1329,11 +1328,11 @@
             return label;
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
-            return getLink(new LinkInfoImpl(configuration, context, classDoc,
-                getAnchor(emd, isProperty), label, strong));
+            return getLink(new LinkInfoImpl(configuration, context, classDoc)
+                .label(label).where(getAnchor(emd, isProperty)).strong(strong));
         } else if (doc instanceof MemberDoc) {
-            return getLink(new LinkInfoImpl(configuration, context, classDoc,
-                doc.name(), label, strong));
+            return getLink(new LinkInfoImpl(configuration, context, classDoc)
+                .label(label).where(doc.name()).strong(strong));
         } else {
             return label;
         }
@@ -1356,12 +1355,12 @@
             Util.isLinkable(classDoc, configuration))) {
             return label;
         } else if (doc instanceof ExecutableMemberDoc) {
-            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
-            return getLink(new LinkInfoImpl(configuration, context, classDoc,
-                getAnchor(emd), label, false));
+            ExecutableMemberDoc emd = (ExecutableMemberDoc) doc;
+            return getLink(new LinkInfoImpl(configuration, context, classDoc)
+                .label(label).where(getAnchor(emd)));
         } else if (doc instanceof MemberDoc) {
-            return getLink(new LinkInfoImpl(configuration, context, classDoc,
-                doc.name(), label, false));
+            return getLink(new LinkInfoImpl(configuration, context, classDoc)
+                .label(label).where(doc.name()));
         } else {
             return label;
         }
@@ -1447,7 +1446,8 @@
             if (label.isEmpty()) {
                 label = plainOrCode(plain, new StringContent(refClass.name()));
             }
-            return getLink(new LinkInfoImpl(configuration, refClass, label)).toString();
+            return getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, refClass)
+                    .label(label)).toString();
         } else if (refMem == null) {
             // Must be a member reference since refClass is not null and refMemName is not null.
             // However, refMem is null, so this referenced member does not exist.
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Tue May 14 10:14:52 2013 -0700
@@ -237,16 +237,13 @@
      *
      * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
-     * @param classDoc   the class to link to.
-     * @param label      the label for the link.
-     * @param target     the value of the target attribute.
+     * @param context               the context of the link.
+     * @param executableMemberDoc   the member to link to.
      */
     public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, ClassDoc classDoc, Content label, String target) {
+            Kind context, ExecutableMemberDoc executableMemberDoc) {
         this.configuration = configuration;
-        this.classDoc = classDoc;
-        this.label = label;
-        this.target = target;
+        this.executableMemberDoc = executableMemberDoc;
         setContext(context);
     }
 
@@ -263,117 +260,11 @@
      * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param classDoc   the class to link to.
-     * @param where      the value of the marker #.
-     * @param label      the label for the link.
-     * @param isStrong       true if the link should be strong.
-     * @param styleName  String style of text defined in style sheet.
-     */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, ClassDoc classDoc, String where, Content label,
-            boolean isStrong, String styleName) {
-        this.configuration = configuration;
-        this.classDoc = classDoc;
-        this.where = where;
-        this.label = label;
-        this.isStrong = isStrong;
-        this.styleName = styleName;
-        setContext(context);
-    }
-
-    /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context    the context of the link.
-     * @param classDoc   the class to link to.
-     * @param where      the value of the marker #.
-     * @param label      the plain-text label for the link.
-     * @param isStrong       true if the link should be strong.
-     */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, ClassDoc classDoc, String where, String label,
-            boolean isStrong) {
-        this(configuration, context, classDoc, where, new StringContent(label),
-                isStrong, "");
-    }
-
-    /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context    the context of the link.
-     * @param classDoc   the class to link to.
-     * @param where      the value of the marker #.
-     * @param label      the label for the link.
-     * @param isStrong       true if the link should be strong.
      */
     public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, ClassDoc classDoc, String where, Content label,
-            boolean isStrong) {
-        this(configuration, context, classDoc, where, label,
-                isStrong, "");
-    }
-
-    /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param classDoc   the class to link to.
-     * @param label      the label for the link.
-     */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            ClassDoc classDoc, Content label) {
-        this.configuration = configuration;
-        this.classDoc = classDoc;
-        this.label = label;
-        setContext(context);
-    }
-
-    /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param classDoc   the class to link to.
-     * @param label      the label for the link.
-     */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            ClassDoc classDoc, String label) {
+            Kind context, ClassDoc classDoc) {
         this.configuration = configuration;
         this.classDoc = classDoc;
-        this.label = new StringContent(label);
-        setContext(context);
-    }
-
-    /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context               the context of the link.
-     * @param executableMemberDoc   the member to link to.
-     * @param isStrong                true if the link should be strong.
-     */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, ExecutableMemberDoc executableMemberDoc,
-            boolean isStrong) {
-        this.configuration = configuration;
-        this.executableMemberDoc = executableMemberDoc;
-        this.isStrong = isStrong;
-        setContext(context);
-    }
-
-    /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context    the context of the link.
-     * @param classDoc   the class to link to.
-     * @param isStrong       true if the link should be strong.
-     */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, ClassDoc classDoc,  boolean isStrong) {
-        this.configuration = configuration;
-        this.classDoc = classDoc;
-        this.isStrong = isStrong;
         setContext(context);
     }
 
@@ -391,91 +282,67 @@
         setContext(context);
     }
 
+
     /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context    the context of the link.
-     * @param type       the class to link to.
-     * @param isVarArg   true if this is a link to a var arg.
+     * Set the label for the link.
+     * @param label plain-text label for the link
      */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, Type type, boolean isVarArg) {
-        this.configuration = configuration;
-        this.type = type;
-        this.isVarArg = isVarArg;
-        setContext(context);
+    public LinkInfoImpl label(String label) {
+        this.label = new StringContent(label);
+        return this;
     }
 
     /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context    the context of the link.
-     * @param type       the class to link to.
-     * @param label      plain-text label for the link.
-     * @param isStrong     true if the link should be strong.
+     * Set the label for the link.
      */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, Type type, String label,
-            boolean isStrong) {
-        this(configuration, context, type, new StringContent(label), isStrong);
+    public LinkInfoImpl label(Content label) {
+        this.label = label;
+        return this;
+    }
+
+    /**
+     * Set whether or not the link should be strong.
+     */
+    public LinkInfoImpl strong(boolean strong) {
+        this.isStrong = strong;
+        return this;
     }
 
     /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context    the context of the link.
-     * @param type       the class to link to.
-     * @param label      the label for the link.
-     * @param isStrong     true if the link should be strong.
+     * Set the style to be used for the link.
+     * @param styleName  String style of text defined in style sheet.
      */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, Type type, Content label,
-            boolean isStrong) {
-        this.configuration = configuration;
-        this.type = type;
-        this.label = label;
-        this.isStrong = isStrong;
-        setContext(context);
+    public LinkInfoImpl styleName(String styleName) {
+        this.styleName = styleName;
+        return this;
     }
 
     /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context    the context of the link.
-     * @param classDoc   the class to link to.
-     * @param label      plain-text label for the link.
-     * @param isStrong       true if the link should be strong.
+     * Set the target to be used for the link.
+     * @param styleName  String style of text defined in style sheet.
      */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, ClassDoc classDoc, String label,
-            boolean isStrong) {
-        this(configuration, context, classDoc, new StringContent(label), isStrong);
+    public LinkInfoImpl target(String target) {
+        this.target = target;
+        return this;
     }
 
     /**
-     * Construct a LinkInfo object.
-     *
-     * @param configuration the configuration data for the doclet
-     * @param context    the context of the link.
-     * @param classDoc   the class to link to.
-     * @param label      the label for the link.
-     * @param isStrong       true if the link should be strong.
+     * Set whether or not this is a link to a varargs parameter.
      */
-    public LinkInfoImpl(ConfigurationImpl configuration,
-            Kind context, ClassDoc classDoc, Content label,
-            boolean isStrong) {
-        this.configuration = configuration;
-        this.classDoc = classDoc;
-        this.label = label;
-        this.isStrong = isStrong;
-        setContext(context);
+    public LinkInfoImpl varargs(boolean varargs) {
+        this.isVarArg = varargs;
+        return this;
     }
 
     /**
+     * Set the fragment specifier for the link.
+     */
+    public LinkInfoImpl where(String where) {
+        this.where = where;
+        return this;
+     }
+
+    /**
      * {@inheritDoc}
      */
     public Kind getContext() {
@@ -546,7 +413,7 @@
         context = c;
         if (type != null &&
             type.asTypeVariable()!= null &&
-            type.asTypeVariable().owner() instanceof ExecutableMemberDoc){
+            type.asTypeVariable().owner() instanceof ExecutableMemberDoc) {
             excludeTypeParameterLinks = true;
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue May 14 10:14:52 2013 -0700
@@ -317,8 +317,8 @@
             String name = method.name();
             Content methlink = writer.getLink(
                     new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
-                    overriddenType.asClassDoc(),
-                    writer.getAnchor(method), name, false));
+                    overriddenType.asClassDoc())
+                    .where(writer.getAnchor(method)).label(name));
             Content codeMethLink = HtmlTree.CODE(methlink);
             Content dd = HtmlTree.DD(codeMethLink);
             dd.addContent(writer.getSpace());
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java	Tue May 14 10:14:52 2013 -0700
@@ -165,7 +165,7 @@
     protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
             Content tdSummary) {
         Content strong = HtmlTree.STRONG(
-                writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member, false)));
+                writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member)));
         Content code = HtmlTree.CODE(strong);
         tdSummary.addContent(code);
     }
@@ -177,7 +177,7 @@
             ProgramElementDoc member, Content linksTree) {
         linksTree.addContent(
                 writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
-                (ClassDoc)member, false)));
+                (ClassDoc)member)));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue May 14 10:14:52 2013 -0700
@@ -185,7 +185,7 @@
                 Content arr_i_name = new StringContent(arr[i].name());
                 if (arr[i].isInterface()) arr_i_name = HtmlTree.I(arr_i_name);
                 Content link = getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i], arr_i_name, "classFrame"));
+                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
                 Content li = HtmlTree.LI(link);
                 ul.addContent(li);
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Tue May 14 10:14:52 2013 -0700
@@ -179,8 +179,7 @@
                     continue;
                 }
                 Content classContent = getLink(new LinkInfoImpl(
-                        configuration, LinkInfoImpl.Kind.PACKAGE, classes[i],
-                        false));
+                        configuration, LinkInfoImpl.Kind.PACKAGE, classes[i]));
                 Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
                 HtmlTree tr = HtmlTree.TR(tdClass);
                 if (i%2 == 0)
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Tue May 14 10:14:52 2013 -0700
@@ -176,7 +176,7 @@
                 Content arr_i_name = new StringContent(arr[i].name());
                 if (arr[i].isInterface()) arr_i_name = HtmlTree.I(arr_i_name);
                 Content link = getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i], arr_i_name, "classFrame"));
+                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
                 Content li = HtmlTree.LI(link);
                 ul.addContent(li);
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Tue May 14 10:14:52 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Tue May 14 10:14:52 2013 -0700
@@ -128,8 +128,8 @@
      */
     public Content getClassHeader(ClassDoc classDoc) {
         Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ?
-            getLink(new LinkInfoImpl(configuration, classDoc,
-            configuration.getClassName(classDoc))) :
+            getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc)
+            .label(configuration.getClassName(classDoc))) :
             new StringContent(classDoc.qualifiedName());
         Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
                 classDoc.qualifiedName()));