src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkInfo.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -21,16 +21,19 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
-package com.sun.tools.doclets.internal.toolkit.util.links;
+package jdk.javadoc.internal.doclets.toolkit.util.links;
 
-import com.sun.javadoc.*;
-import com.sun.tools.doclets.internal.toolkit.Configuration;
-import com.sun.tools.doclets.internal.toolkit.Content;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeMirror;
 
+import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+
 /**
  * Encapsulates information about a link.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.

@@ -41,25 +44,25 @@
  * @since 1.5
  */
 public abstract class LinkInfo {
 
     /**
-     * The ClassDoc we want to link to.  Null if we are not linking
-     * to a ClassDoc.
+     * The class we want to link to.  Null if we are not linking
+     * to a class.
      */
-    public ClassDoc classDoc;
+    public TypeElement typeElement;
 
     /**
-     * The executable member doc we want to link to.  Null if we are not linking
-     * to an executable member.
+     * The executable element we want to link to.  Null if we are not linking
+     * to an executable element.
      */
-    public ExecutableMemberDoc executableMemberDoc;
+    public ExecutableElement executableElement;
 
     /**
      * The Type we want to link to.  Null if we are not linking to a type.
      */
-    public Type type;
+    public TypeMirror type;
 
     /**
      * True if this is a link to a VarArg.
      */
     public boolean isVarArg = false;

@@ -140,15 +143,33 @@
      */
     public Content getClassLinkLabel(Configuration configuration) {
         if (label != null && !label.isEmpty()) {
             return label;
         } else if (isLinkable()) {
-            Content label = newContent();
-            label.addContent(classDoc.name());
-            return label;
+            Content tlabel = newContent();
+            tlabel.addContent(configuration.utils.getSimpleName(typeElement));
+            return tlabel;
         } else {
-            Content label = newContent();
-            label.addContent(configuration.getClassName(classDoc));
-            return label;
+            Content tlabel = newContent();
+            tlabel.addContent(configuration.getClassName(typeElement));
+            return tlabel;
         }
     }
+
+    @Override
+    public String toString() {
+        return "LinkInfo{" + "typeElement=" + typeElement +
+                ", executableElement=" + executableElement +
+                ", type=" + type +
+                ", isVarArg=" + isVarArg +
+                ", isTypeBound=" + isTypeBound +
+                ", isJava5DeclarationLocation=" + isJava5DeclarationLocation +
+                ", label=" + label +
+                ", isStrong=" + isStrong +
+                ", includeTypeInClassLinkLabel=" + includeTypeInClassLinkLabel +
+                ", includeTypeAsSepLink=" + includeTypeAsSepLink +
+                ", excludeTypeBounds=" + excludeTypeBounds +
+                ", excludeTypeParameterLinks=" + excludeTypeParameterLinks +
+                ", excludeTypeBoundsLinks=" + excludeTypeBoundsLinks +
+                ", linkToSelf=" + linkToSelf + '}';
+    }
 }