< prev index next >
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java
Print this page
*** 26,47 ****
package jdk.javadoc.internal.doclets.toolkit.util.links;
import java.util.ArrayList;
import java.util.List;
- import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.TypeParameterElement;
import javax.lang.model.type.ArrayType;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
import javax.lang.model.type.WildcardType;
import javax.lang.model.util.SimpleTypeVisitor9;
- import jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
/**
* A factory that constructs links from given link information.
--- 26,45 ----
*** 52,61 ****
--- 50,64 ----
* deletion without notice.</b>
*
* @author Jamie Ho
*/
public abstract class LinkFactory {
+ protected final Utils utils;
+
+ protected LinkFactory(Utils utils) {
+ this.utils = utils;
+ }
/**
* Return an empty instance of a content object.
*
* @return an empty instance of a content object.
*** 67,77 ****
*
* @param linkInfo the information about the link.
* @return the output of the link.
*/
public Content getLink(LinkInfo linkInfo) {
- Utils utils = ((LinkInfoImpl) linkInfo).configuration.utils;
if (linkInfo.type != null) {
SimpleTypeVisitor9<Content, LinkInfo> linkVisitor =
new SimpleTypeVisitor9<Content, LinkInfo>() {
TypeMirror componentType = utils.getComponentType(linkInfo.type);
--- 70,79 ----
*** 205,250 ****
linkInfo.label = null;
linkInfo.type = bound;
}
/**
! * Return the link to the given class.
*
! * @param linkInfo the information about the link to construct.
*
* @return the link for the given class.
*/
protected abstract Content getClassLink(LinkInfo linkInfo);
/**
! * Return the link to the given type parameter.
*
! * @param linkInfo the information about the link to construct.
! * @param typeParam the type parameter to link to.
*/
protected abstract Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam);
/**
! * Return the links to the type parameters.
*
! * @param linkInfo the information about the link to construct.
* @return the links to the type parameters.
*/
public Content getTypeParameterLinks(LinkInfo linkInfo) {
return getTypeParameterLinks(linkInfo, true);
}
/**
! * Return the links to the type parameters.
*
! * @param linkInfo the information about the link to construct.
! * @param isClassLabel true if this is a class label. False if it is
! * the type parameters portion of the link.
! * @return the links to the type parameters.
*/
public Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) {
- Utils utils = ((LinkInfoImpl)linkInfo).utils;
Content links = newContent();
List<TypeMirror> vars = new ArrayList<>();
TypeMirror ctype = linkInfo.type != null
? utils.getComponentType(linkInfo.type)
: null;
--- 207,252 ----
linkInfo.label = null;
linkInfo.type = bound;
}
/**
! * Returns a link to the given class.
*
! * @param linkInfo the information about the link to construct
*
* @return the link for the given class.
*/
protected abstract Content getClassLink(LinkInfo linkInfo);
/**
! * Returns a link to the given type parameter.
*
! * @param linkInfo the information about the link to construct
! * @param typeParam the type parameter to link to
! * @return the link
*/
protected abstract Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam);
/**
! * Returns links to the type parameters.
*
! * @param linkInfo the information about the link to construct
* @return the links to the type parameters.
*/
public Content getTypeParameterLinks(LinkInfo linkInfo) {
return getTypeParameterLinks(linkInfo, true);
}
/**
! * Returns links to the type parameters.
*
! * @param linkInfo the information about the link to construct
! * @param isClassLabel true if this is a class label, or false if it is
! * the type parameters portion of the link
! * @return the links to the type parameters
*/
public Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) {
Content links = newContent();
List<TypeMirror> vars = new ArrayList<>();
TypeMirror ctype = linkInfo.type != null
? utils.getComponentType(linkInfo.type)
: null;
< prev index next >