8283269: Improve definition and use of jdk.javadoc.internal.doclets.toolkit.Content

Reviewed-by: jjg
This commit is contained in:
Pavel Rappo 2022-04-01 13:05:48 +00:00
parent fc7a17c79b
commit dbfac3c99c
76 changed files with 2200 additions and 2399 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -100,52 +100,37 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
member, content, null, false);
}
/**
* Add the summary link for the member.
*
* @param context the id of the context where the link will be printed
* @param te the type element being linked to
* @param member the member being linked to
* @param tdSummary the content tree to which the link will be added
*/
@Override
protected void addSummaryLink(HtmlLinkInfo.Kind context, TypeElement te, Element member,
Content tdSummary) {
Content target) {
ExecutableElement ee = (ExecutableElement)member;
Content memberLink = writer.getDocLink(context, te, ee, name(ee), HtmlStyle.memberNameLink);
Content code = HtmlTree.CODE(memberLink);
var code = HtmlTree.CODE(memberLink);
addParameters(ee, code);
tdSummary.add(code);
target.add(code);
}
/**
* Add the inherited summary link for the member.
*
* @param te the type element that we should link to
* @param member the member being linked to
* @param linksTree the content tree to which the link will be added
*/
@Override
protected void addInheritedSummaryLink(TypeElement te, Element member, Content linksTree) {
linksTree.add(writer.getDocLink(MEMBER, te, member, name(member)));
protected void addInheritedSummaryLink(TypeElement te, Element member, Content target) {
target.add(writer.getDocLink(MEMBER, te, member, name(member)));
}
/**
* Add the parameter for the executable member.
*
* @param param the parameter that needs to be written.
* @param param the parameter that needs to be added.
* @param paramType the type of the parameter.
* @param isVarArg true if this is a link to var arg.
* @param tree the content tree to which the parameter information will be added.
* @param target the content to which the parameter information will be added.
*/
protected void addParam(VariableElement param, TypeMirror paramType, boolean isVarArg,
Content tree) {
Content target) {
Content link = writer.getLink(new HtmlLinkInfo(configuration, EXECUTABLE_MEMBER_PARAM,
paramType).varargs(isVarArg));
tree.add(link);
target.add(link);
if(name(param).length() > 0) {
tree.add(Entity.NO_BREAK_SPACE);
tree.add(name(param));
target.add(Entity.NO_BREAK_SPACE);
target.add(name(param));
}
}
@ -156,18 +141,18 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
*
* @param member the member to write receiver annotations for.
* @param rcvrType the receiver type.
* @param tree the content tree to which the information will be added.
* @param target the content to which the information will be added.
*/
protected void addReceiver(ExecutableElement member, TypeMirror rcvrType, Content tree) {
protected void addReceiver(ExecutableElement member, TypeMirror rcvrType, Content target) {
var info = new HtmlLinkInfo(configuration, RECEIVER_TYPE, rcvrType);
info.linkToSelf = false;
tree.add(writer.getLink(info));
tree.add(Entity.NO_BREAK_SPACE);
target.add(writer.getLink(info));
target.add(Entity.NO_BREAK_SPACE);
if (member.getKind() == ElementKind.CONSTRUCTOR) {
tree.add(utils.getTypeName(rcvrType, false));
tree.add(".");
target.add(utils.getTypeName(rcvrType, false));
target.add(".");
}
tree.add("this");
target.add("this");
}
/**
@ -205,15 +190,15 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
* Add all the parameters for the executable member.
*
* @param member the member to write parameters for.
* @param htmltree the content tree to which the parameters information will be added.
* @param target the content to which the parameters information will be added.
*/
protected void addParameters(ExecutableElement member, Content htmltree) {
Content paramTree = getParameters(member, false);
if (paramTree.charCount() > 2) {
protected void addParameters(ExecutableElement member, Content target) {
Content params = getParameters(member, false);
if (params.charCount() > 2) {
// only add <wbr> for non-empty parameters
htmltree.add(new HtmlTree(TagName.WBR));
target.add(new HtmlTree(TagName.WBR));
}
htmltree.add(paramTree);
target.add(params);
}
/**
@ -221,22 +206,22 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
*
* @param member the member to write parameters for.
* @param includeAnnotations true if annotation information needs to be added.
* @return the content tree containing the parameter information
* @return the parameter information
*/
protected Content getParameters(ExecutableElement member, boolean includeAnnotations) {
Content paramTree = new ContentBuilder();
paramTree.add("(");
Content result = new ContentBuilder();
result.add("(");
String sep = "";
List<? extends VariableElement> parameters = member.getParameters();
TypeMirror rcvrType = member.getReceiverType();
if (includeAnnotations && rcvrType != null && isAnnotatedReceiver(rcvrType)) {
addReceiver(member, rcvrType, paramTree);
addReceiver(member, rcvrType, result);
sep = "," + DocletConstants.NL + " ";
}
int paramstart;
ExecutableType instMeth = utils.asInstantiatedMethodType(typeElement, member);
for (paramstart = 0; paramstart < parameters.size(); paramstart++) {
paramTree.add(sep);
result.add(sep);
VariableElement param = parameters.get(paramstart);
TypeMirror paramType = instMeth.getParameterTypes().get(paramstart);
@ -244,56 +229,56 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
if (includeAnnotations) {
Content annotationInfo = writer.getAnnotationInfo(param, false);
if (!annotationInfo.isEmpty()) {
paramTree.add(annotationInfo)
result.add(annotationInfo)
.add(DocletConstants.NL)
.add(" ");
}
}
addParam(param, paramType,
(paramstart == parameters.size() - 1) && member.isVarArgs(), paramTree);
(paramstart == parameters.size() - 1) && member.isVarArgs(), result);
break;
}
}
for (int i = paramstart + 1; i < parameters.size(); i++) {
paramTree.add(",");
paramTree.add(DocletConstants.NL);
paramTree.add(" ");
result.add(",");
result.add(DocletConstants.NL);
result.add(" ");
if (includeAnnotations) {
Content annotationInfo = writer.getAnnotationInfo(parameters.get(i), false);
if (!annotationInfo.isEmpty()) {
paramTree.add(annotationInfo)
result.add(annotationInfo)
.add(DocletConstants.NL)
.add(" ");
}
}
addParam(parameters.get(i), instMeth.getParameterTypes().get(i),
(i == parameters.size() - 1) && member.isVarArgs(),
paramTree);
result);
}
paramTree.add(")");
return paramTree;
result.add(")");
return result;
}
/**
* Get a content tree containing the exception information for the executable member.
* Get the exception information for the executable member.
*
* @param member the member to write exceptions for.
* @return the content tree containing the exceptions information.
* @param member the member to get the exception information for
* @return the exception information
*/
protected Content getExceptions(ExecutableElement member) {
List<? extends TypeMirror> exceptions = utils.asInstantiatedMethodType(typeElement, member).getThrownTypes();
Content htmlTree = new ContentBuilder();
Content result = new ContentBuilder();
for (TypeMirror t : exceptions) {
if (!htmlTree.isEmpty()) {
htmlTree.add(",");
htmlTree.add(DocletConstants.NL);
if (!result.isEmpty()) {
result.add(",");
result.add(DocletConstants.NL);
}
Content link = writer.getLink(new HtmlLinkInfo(configuration, THROWS_TYPE, t));
htmlTree.add(link);
result.add(link);
}
return htmlTree;
return result;
}
protected TypeElement implementsMethodInIntfac(ExecutableElement method,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -91,9 +91,9 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
/**
* Adds the summary label for the member.
*
* @param memberTree the content tree to which the label will be added
* @param content the content to which the label will be added
*/
public abstract void addSummaryLabel(Content memberTree);
public abstract void addSummaryLabel(Content content);
/**
* Returns the summary table header for the member.
@ -126,28 +126,28 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
/**
* Adds inherited summary label for the member.
*
* @param typeElement the type element to which to link to
* @param inheritedTree the content tree to which the inherited summary label will be added
* @param typeElement the type element to which to link to
* @param content the content to which the inherited summary label will be added
*/
public abstract void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree);
public abstract void addInheritedSummaryLabel(TypeElement typeElement, Content content);
/**
* Adds the summary type for the member.
*
* @param member the member to be documented
* @param tdSummaryType the content tree to which the type will be added
* @param member the member to be documented
* @param content the content to which the type will be added
*/
protected abstract void addSummaryType(Element member, Content tdSummaryType);
protected abstract void addSummaryType(Element member, Content content);
/**
* Adds the summary link for the member.
*
* @param typeElement the type element to be documented
* @param member the member to be documented
* @param tdSummary the content tree to which the link will be added
* @param content the content to which the link will be added
*/
protected void addSummaryLink(TypeElement typeElement, Element member, Content tdSummary) {
addSummaryLink(HtmlLinkInfo.Kind.MEMBER, typeElement, member, tdSummary);
protected void addSummaryLink(TypeElement typeElement, Element member, Content content) {
addSummaryLink(HtmlLinkInfo.Kind.MEMBER, typeElement, member, content);
}
/**
@ -156,41 +156,41 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
* @param context the id of the context where the link will be printed
* @param typeElement the type element to be documented
* @param member the member to be documented
* @param tdSummary the content tree to which the summary link will be added
* @param content the content to which the summary link will be added
*/
protected abstract void addSummaryLink(HtmlLinkInfo.Kind context,
TypeElement typeElement, Element member, Content tdSummary);
TypeElement typeElement, Element member, Content content);
/**
* Adds the inherited summary link for the member.
*
* @param typeElement the type element to be documented
* @param member the member to be documented
* @param linksTree the content tree to which the inherited summary link will be added
* @param target the content to which the inherited summary link will be added
*/
protected abstract void addInheritedSummaryLink(TypeElement typeElement,
Element member, Content linksTree);
Element member, Content target);
/**
* Returns a link for summary (deprecated, preview) pages.
*
* @param member the member being linked to
*
* @return a content tree representing the link
* @return the link
*/
protected abstract Content getSummaryLink(Element member);
/**
* Adds the modifier and type for the member in the member summary.
* Adds the modifiers and type for the member in the member summary.
*
* @param member the member to add the type for
* @param type the type to add
* @param tdSummaryType the content tree to which the modified and type will be added
* @param member the member to add the modifiers and type for
* @param type the type to add
* @param target the content to which the modifiers and type will be added
*/
protected void addModifierAndType(Element member, TypeMirror type,
Content tdSummaryType) {
HtmlTree code = new HtmlTree(TagName.CODE);
addModifier(member, code);
protected void addModifiersAndType(Element member, TypeMirror type,
Content target) {
var code = new HtmlTree(TagName.CODE);
addModifiers(member, code);
if (type == null) {
code.add(switch (member.getKind()) {
case ENUM -> "enum";
@ -219,64 +219,64 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
writer.getLink(new HtmlLinkInfo(configuration,
HtmlLinkInfo.Kind.SUMMARY_RETURN_TYPE, type)));
}
tdSummaryType.add(code);
target.add(code);
}
/**
* Adds the modifier for the member.
* Adds the modifiers for the member.
*
* @param member the member to add the type for
* @param code the content tree to which the modifier will be added
* @param member the member to add the modifiers for
* @param target the content to which the modifiers will be added
*/
private void addModifier(Element member, Content code) {
private void addModifiers(Element member, Content target) {
if (utils.isProtected(member)) {
code.add("protected ");
target.add("protected ");
} else if (utils.isPrivate(member)) {
code.add("private ");
target.add("private ");
} else if (!utils.isPublic(member)) { // Package private
code.add(resources.getText("doclet.Package_private"));
code.add(" ");
target.add(resources.getText("doclet.Package_private"));
target.add(" ");
}
boolean isAnnotatedTypeElement = utils.isAnnotationType(member.getEnclosingElement());
if (!isAnnotatedTypeElement && utils.isMethod(member)) {
if (!utils.isInterface(member.getEnclosingElement()) && utils.isAbstract(member)) {
code.add("abstract ");
target.add("abstract ");
}
if (utils.isDefault(member)) {
code.add("default ");
target.add("default ");
}
}
if (utils.isStatic(member)) {
code.add("static ");
target.add("static ");
}
if (!utils.isEnum(member) && utils.isFinal(member)) {
code.add("final ");
target.add("final ");
}
}
/**
* Adds the deprecated information for the given member.
*
* @param member the member being documented.
* @param contentTree the content tree to which the deprecated information will be added.
* @param member the member being documented.
* @param target the content to which the deprecated information will be added.
*/
protected void addDeprecatedInfo(Element member, Content contentTree) {
protected void addDeprecatedInfo(Element member, Content target) {
Content output = (new DeprecatedTaglet()).getAllBlockTagOutput(member,
writer.getTagletWriterInstance(false));
if (!output.isEmpty()) {
contentTree.add(HtmlTree.DIV(HtmlStyle.deprecationBlock, output));
target.add(HtmlTree.DIV(HtmlStyle.deprecationBlock, output));
}
}
/**
* Adds the comment for the given member.
*
* @param member the member being documented.
* @param htmlTree the content tree to which the comment will be added.
* @param member the member being documented.
* @param content the content to which the comment will be added.
*/
protected void addComment(Element member, Content htmlTree) {
protected void addComment(Element member, Content content) {
if (!utils.getFullBody(member).isEmpty()) {
writer.addInlineComment(member, htmlTree);
writer.addInlineComment(member, content);
}
}
@ -284,10 +284,10 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
* Add the preview information for the given member.
*
* @param member the member being documented.
* @param contentTree the content tree to which the preview information will be added.
* @param content the content to which the preview information will be added.
*/
protected void addPreviewInfo(Element member, Content contentTree) {
writer.addPreviewInfo(member, contentTree);
protected void addPreviewInfo(Element member, Content content) {
writer.addPreviewInfo(member, content);
}
protected String name(Element member) {
@ -295,13 +295,13 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
}
/**
* Adds use information to the documentation tree.
* Adds use information to the documentation.
*
* @param members list of program elements for which the use information will be added
* @param heading the section heading
* @param contentTree the content tree to which the use information will be added
* @param members list of program elements for which the use information will be added
* @param heading the section heading
* @param content the content to which the use information will be added
*/
protected void addUseInfo(List<? extends Element> members, Content heading, Content contentTree) {
protected void addUseInfo(List<? extends Element> members, Content heading, Content content) {
if (members == null || members.isEmpty()) {
return;
}
@ -325,7 +325,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
&& !utils.isClass(element)
&& !utils.isInterface(element)
&& !utils.isAnnotationType(element)) {
HtmlTree name = new HtmlTree(TagName.SPAN);
var name = new HtmlTree(TagName.SPAN);
name.setStyle(HtmlStyle.typeNameLabel);
name.add(name(te) + ".");
typeContent.add(name);
@ -338,7 +338,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
writer.addSummaryLinkComment(element, desc);
useTable.addRow(summaryType, typeContent, desc);
}
contentTree.add(useTable);
content.add(useTable);
}
protected void serialWarning(Element e, String key, String a1, String a2) {
@ -371,24 +371,24 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
@Override
public void addInheritedMemberSummary(TypeElement tElement,
Element nestedClass, boolean isFirst, boolean isLast,
Content linksTree) {
writer.addInheritedMemberSummary(this, tElement, nestedClass, isFirst, linksTree);
Content content) {
writer.addInheritedMemberSummary(this, tElement, nestedClass, isFirst, content);
}
@Override
public Content getInheritedSummaryHeader(TypeElement tElement) {
Content inheritedTree = writer.getMemberInheritedTree();
writer.addInheritedSummaryHeader(this, tElement, inheritedTree);
return inheritedTree;
Content c = writer.getMemberInherited();
writer.addInheritedSummaryHeader(this, tElement, c);
return c;
}
@Override
public Content getInheritedSummaryLinksTree() {
public Content getInheritedSummaryLinks() {
return new HtmlTree(TagName.CODE);
}
@Override
public Content getSummaryTableTree(TypeElement tElement) {
public Content getSummaryTable(TypeElement tElement) {
if (tElement != typeElement) {
throw new IllegalStateException();
}
@ -400,8 +400,8 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
}
@Override
public Content getMemberTree(Content memberTree) {
return writer.getMemberTree(memberTree);
public Content getMember(Content memberContent) {
return writer.getMember(memberContent);
}
@Override
@ -410,8 +410,8 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
}
@Override
public Content getMemberListItem(Content memberTree) {
return writer.getMemberListItem(memberTree);
public Content getMemberListItem(Content memberContent) {
return writer.getMemberListItem(memberContent);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, 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
@ -62,35 +62,34 @@ public abstract class AbstractOverviewIndexWriter extends HtmlDocletWriter {
* summary at the top of the page and generate a link to the description,
* which is added at the end of this page.
*
* @param main the documentation tree to which the overview header will be added
* @param target the content to which the overview header will be added
*/
protected void addOverviewHeader(Content main) {
addConfigurationTitle(main);
addOverviewComment(main);
addOverviewTags(main);
protected void addOverviewHeader(Content target) {
addConfigurationTitle(target);
addOverviewComment(target);
addOverviewTags(target);
}
/**
* Adds the overview comment as provided in the file specified by the
* "-overview" option on the command line.
*
* @param htmltree the documentation tree to which the overview comment will
* be added
* @param content the content to which the overview comment will be added
*/
protected void addOverviewComment(Content htmltree) {
protected void addOverviewComment(Content content) {
if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
addInlineComment(configuration.overviewElement, htmltree);
addInlineComment(configuration.overviewElement, content);
}
}
/**
* Adds the block tags provided in the file specified by the "-overview" option.
*
* @param htmlTree the content tree to which the tags will be added
* @param content the content to which the tags will be added
*/
protected void addOverviewTags(Content htmlTree) {
protected void addOverviewTags(Content content) {
if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
addTagsInfo(configuration.overviewElement, htmlTree);
addTagsInfo(configuration.overviewElement, content);
}
}
@ -118,25 +117,25 @@ public abstract class AbstractOverviewIndexWriter extends HtmlDocletWriter {
}
/**
* Adds the index to the documentation tree.
* Adds the index to the documentation.
*
* @param main the document tree to which the packages/modules list will be added
* @param target the content to which the packages/modules list will be added
*/
protected abstract void addIndex(Content main);
protected abstract void addIndex(Content target);
/**
* Adds the doctitle to the documentation tree, if it is specified on the command line.
* Adds the doctitle to the documentation, if it is specified on the command line.
*
* @param body the document tree to which the title will be added
* @param target the content to which the title will be added
*/
protected void addConfigurationTitle(Content body) {
protected void addConfigurationTitle(Content target) {
String doctitle = configuration.getOptions().docTitle();
if (!doctitle.isEmpty()) {
Content title = new RawHtml(doctitle);
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
var title = new RawHtml(doctitle);
var heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, title);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
body.add(div);
var div = HtmlTree.DIV(HtmlStyle.header, heading);
target.add(div);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022, 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
@ -77,14 +77,14 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
* @param parent the superclass or superinterface of the sset
* @param collection a collection of the sub-classes at this level
* @param isEnum true if we are generating a tree for enums
* @param contentTree the content tree to which the level information will be added
* @param content the content to which the level information will be added
*/
protected void addLevelInfo(TypeElement parent, Collection<TypeElement> collection,
boolean isEnum, Content contentTree) {
boolean isEnum, Content content) {
if (!collection.isEmpty()) {
Content ul = new HtmlTree(TagName.UL);
var ul = new HtmlTree(TagName.UL);
for (TypeElement local : collection) {
HtmlTree li = new HtmlTree(TagName.LI);
var li = new HtmlTree(TagName.LI);
li.setStyle(HtmlStyle.circle);
addPartialInfo(local, li);
addExtendsImplements(parent, local, li);
@ -92,7 +92,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
isEnum, li); // Recurse
ul.add(li);
}
contentTree.add(ul);
content.add(ul);
}
}
@ -103,7 +103,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
* @param sset classes which are at the most base level, all the
* other classes in this run will derive from these classes
* @param heading heading for the tree
* @param content the content tree to which the tree will be added
* @param content the content to which the tree will be added
*/
protected void addTree(SortedSet<TypeElement> sset, String heading, Content content) {
addTree(sset, heading, content, false);
@ -114,12 +114,12 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
if (!sset.isEmpty()) {
TypeElement firstTypeElement = sset.first();
Content headingContent = contents.getContent(heading);
Content sectionHeading = HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
var sectionHeading = HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
headingContent);
HtmlTree htmlTree = HtmlTree.SECTION(HtmlStyle.hierarchy, sectionHeading);
var section = HtmlTree.SECTION(HtmlStyle.hierarchy, sectionHeading);
addLevelInfo(!utils.isInterface(firstTypeElement) ? firstTypeElement : null,
sset, isEnums, htmlTree);
content.add(htmlTree);
sset, isEnums, section);
content.add(section);
}
}
@ -129,11 +129,11 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
*
* @param parent the parent class of the class being documented
* @param typeElement the TypeElement under consideration
* @param contentTree the content tree to which the information will be added
* @param content the content to which the information will be added
*/
protected void addExtendsImplements(TypeElement parent,
TypeElement typeElement,
Content contentTree)
Content content)
{
SortedSet<TypeElement> interfaces = new TreeSet<>(comparators.makeGeneralPurposeComparator());
typeElement.getInterfaces().forEach(t -> interfaces.add(utils.asTypeElement(t)));
@ -145,21 +145,21 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
if (isFirst) {
isFirst = false;
if (utils.isInterface(typeElement)) {
contentTree.add(" (");
contentTree.add(contents.also);
contentTree.add(" extends ");
content.add(" (");
content.add(contents.also);
content.add(" extends ");
} else {
contentTree.add(" (implements ");
content.add(" (implements ");
}
} else {
contentTree.add(", ");
content.add(", ");
}
addPreQualifiedClassLink(HtmlLinkInfo.Kind.TREE, intf, contentTree);
addPreQualifiedClassLink(HtmlLinkInfo.Kind.TREE, intf, content);
}
}
}
if (!isFirst) {
contentTree.add(")");
content.add(")");
}
}
}
@ -168,9 +168,9 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
* Add information about the class kind, if it's a "class" or "interface".
*
* @param typeElement the class being documented
* @param contentTree the content tree to which the information will be added
* @param content the content to which the information will be added
*/
protected void addPartialInfo(TypeElement typeElement, Content contentTree) {
addPreQualifiedStrongClassLink(HtmlLinkInfo.Kind.TREE, typeElement, contentTree);
protected void addPartialInfo(TypeElement typeElement, Content content) {
addPreQualifiedStrongClassLink(HtmlLinkInfo.Kind.TREE, typeElement, content);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, 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
@ -97,20 +97,20 @@ public class AllClassesIndexWriter extends HtmlDocletWriter {
addContents(allClassesContent);
Content mainContent = new ContentBuilder();
mainContent.add(allClassesContent);
HtmlTree bodyTree = getBody(getWindowTitle(label));
bodyTree.add(new BodyContents()
HtmlTree body = getBody(getWindowTitle(label));
body.add(new BodyContents()
.setHeader(getHeader(PageMode.ALL_CLASSES))
.addMainContent(mainContent)
.setFooter(getFooter()));
printHtmlDocument(null, "class index", bodyTree);
printHtmlDocument(null, "class index", body);
}
/**
* Add all types to the content tree.
* Add all types to the content.
*
* @param content HtmlTree content to which the links will be added
* @param target the content to which the links will be added
*/
protected void addContents(Content content) {
protected void addContents(Content target) {
Table table = new Table(HtmlStyle.summaryTable)
.setHeader(new TableHeader(contents.classLabel, contents.descriptionLabel))
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast)
@ -131,12 +131,12 @@ public class AllClassesIndexWriter extends HtmlDocletWriter {
}
}
Content titleContent = contents.allClassesAndInterfacesLabel;
Content pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, titleContent);
Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
content.add(headerDiv);
var headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
target.add(headerDiv);
if (!table.isEmpty()) {
content.add(table);
target.add(table);
if (table.needsScript()) {
getMainBodyScript().append(table.getScript());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, 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
@ -76,24 +76,24 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter {
Content mainContent = new ContentBuilder();
addPackages(mainContent);
Content titleContent = contents.allPackagesLabel;
Content pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, titleContent);
Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
HtmlTree bodyTree = getBody(getWindowTitle(label));
bodyTree.add(new BodyContents()
var headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
HtmlTree body = getBody(getWindowTitle(label));
body.add(new BodyContents()
.setHeader(getHeader(PageMode.ALL_PACKAGES))
.addMainContent(headerDiv)
.addMainContent(mainContent)
.setFooter(getFooter()));
printHtmlDocument(null, "package index", bodyTree);
printHtmlDocument(null, "package index", body);
}
/**
* Add all the packages to the content tree.
* Add all the packages to the content.
*
* @param content HtmlTree content to which the links will be added
* @param target the content to which the links will be added
*/
protected void addPackages(Content content) {
protected void addPackages(Content target) {
Table table = new Table(HtmlStyle.summaryTable)
.setCaption(Text.of(contents.packageSummaryLabel.toString()))
.setHeader(new TableHeader(contents.packageLabel, contents.descriptionLabel))
@ -106,6 +106,6 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter {
table.addRow(pkg, packageLinkContent, summaryContent);
}
}
content.add(table);
target.add(table);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -92,24 +92,24 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
@Override
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
Content content) {
switch (kind) {
case OPTIONAL -> memberSummaryTree.add(selectComment(
case OPTIONAL -> content.add(selectComment(
MarkerComments.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY,
MarkerComments.START_OF_ANNOTATION_INTERFACE_OPTIONAL_MEMBER_SUMMARY));
case REQUIRED -> memberSummaryTree.add(selectComment(
case REQUIRED -> content.add(selectComment(
MarkerComments.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY,
MarkerComments.START_OF_ANNOTATION_INTERFACE_REQUIRED_MEMBER_SUMMARY));
case ANY -> throw new UnsupportedOperationException("unsupported member kind");
}
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;
Content c = new ContentBuilder();
writer.addSummaryHeader(this, c);
return c;
}
@Override
public Content getMemberTreeHeader() {
return writer.getMemberTreeHeader();
public Content getMemberHeader() {
return writer.getMemberHeader();
}
@Override
@ -131,21 +131,21 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
}
@Override
public Content getAnnotationDetailsTreeHeader() {
Content memberDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
public Content getAnnotationDetailsHeader() {
Content memberDetails = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.annotationTypeDetailsLabel);
memberDetailsTree.add(heading);
return memberDetailsTree;
memberDetails.add(heading);
return memberDetails;
}
@Override
public Content getAnnotationDocTreeHeader(Element member) {
Content annotationDocTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
public Content getAnnotationHeaderContent(Element member) {
Content content = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
Text.of(name(member)));
annotationDocTree.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree)
content.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, content)
.setId(htmlIds.forMember(typeElement, (ExecutableElement) member));
}
@ -158,40 +158,40 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
}
@Override
public void addDeprecated(Element member, Content annotationDocTree) {
addDeprecatedInfo(member, annotationDocTree);
public void addDeprecated(Element member, Content target) {
addDeprecatedInfo(member, target);
}
@Override
public void addPreview(Element member, Content contentTree) {
addPreviewInfo(member, contentTree);
public void addPreview(Element member, Content content) {
addPreviewInfo(member, content);
}
@Override
public void addComments(Element member, Content annotationDocTree) {
addComment(member, annotationDocTree);
public void addComments(Element member, Content annotationContent) {
addComment(member, annotationContent);
}
@Override
public void addTags(Element member, Content annotationDocTree) {
writer.addTagsInfo(member, annotationDocTree);
public void addTags(Element member, Content annotationContent) {
writer.addTagsInfo(member, annotationContent);
}
@Override
public Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree) {
Content annotationDetails = new ContentBuilder(annotationDetailsTreeHeader, annotationDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.memberDetails, annotationDetails));
public Content getAnnotationDetails(Content annotationDetailsHeader, Content annotationDetails) {
Content c = new ContentBuilder(annotationDetailsHeader, annotationDetails);
return getMember(HtmlTree.SECTION(HtmlStyle.memberDetails, c));
}
@Override
public void addSummaryLabel(Content memberTree) {
HtmlTree label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
public void addSummaryLabel(Content content) {
var label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
switch (kind) {
case REQUIRED -> contents.annotateTypeRequiredMemberSummaryLabel;
case OPTIONAL -> contents.annotateTypeOptionalMemberSummaryLabel;
case ANY -> throw new UnsupportedOperationException("unsupported member kind");
});
memberTree.add(label);
content.add(label);
}
/**
@ -227,27 +227,27 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
}
@Override
public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
public void addInheritedSummaryLabel(TypeElement typeElement, Content content) {
}
@Override
protected void addSummaryLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Element member,
Content tdSummary) {
Content content) {
Content memberLink = writer.getDocLink(context, utils.getEnclosingTypeElement(member), member,
name(member), HtmlStyle.memberNameLink);
Content code = HtmlTree.CODE(memberLink);
tdSummary.add(code);
var code = HtmlTree.CODE(memberLink);
content.add(code);
}
@Override
protected void addInheritedSummaryLink(TypeElement typeElement,
Element member, Content linksTree) {
Element member, Content target) {
//Not applicable.
}
@Override
protected void addSummaryType(Element member, Content tdSummaryType) {
addModifierAndType(member, getType(member), tdSummaryType);
protected void addSummaryType(Element member, Content content) {
addModifiersAndType(member, getType(member), content);
}
@Override
@ -268,15 +268,15 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
: member.asType();
}
public void addDefaultValueInfo(Element member, Content annotationDocTree) {
public void addDefaultValueInfo(Element member, Content annotationContent) {
if (utils.isAnnotationType(member)) {
ExecutableElement ee = (ExecutableElement) member;
AnnotationValue value = ee.getDefaultValue();
if (value != null) {
Content dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(contents.default_));
dl.add(HtmlTree.DD(Text.of(value.toString())));
annotationDocTree.add(dl);
annotationContent.add(dl);
}
}
}

View File

@ -230,24 +230,24 @@ public class ClassUseWriter extends SubWriterHolderWriter {
/**
* Add the class use documentation.
*
* @param contentTree the content tree to which the class use information will be added
* @param content the content to which the class use information will be added
*/
protected void addClassUse(Content contentTree) {
Content content = new ContentBuilder();
protected void addClassUse(Content content) {
Content c = new ContentBuilder();
if (configuration.packages.size() > 1) {
addPackageList(content);
addPackageAnnotationList(content);
addPackageList(c);
addPackageAnnotationList(c);
}
addClassList(content);
contentTree.add(content);
addClassList(c);
content.add(c);
}
/**
* Add the packages elements that use the given class.
*
* @param contentTree the content tree to which the packages elements will be added
* @param content the content to which the packages elements will be added
*/
protected void addPackageList(Content contentTree) {
protected void addPackageList(Content content) {
Content caption = contents.getContent(
"doclet.ClassUse_Packages.that.use.0",
getLink(new HtmlLinkInfo(configuration,
@ -259,15 +259,15 @@ public class ClassUseWriter extends SubWriterHolderWriter {
for (PackageElement pkg : pkgSet) {
addPackageUse(pkg, table);
}
contentTree.add(table);
content.add(table);
}
/**
* Add the package annotation elements.
*
* @param contentTree the content tree to which the package annotation elements will be added
* @param content the content to which the package annotation elements will be added
*/
protected void addPackageAnnotationList(Content contentTree) {
protected void addPackageAnnotationList(Content content) {
if (!utils.isAnnotationType(typeElement) ||
pkgToPackageAnnotations == null ||
pkgToPackageAnnotations.isEmpty()) {
@ -287,30 +287,30 @@ public class ClassUseWriter extends SubWriterHolderWriter {
addSummaryComment(pkg, summary);
table.addRow(getPackageLink(pkg, getLocalizedPackageName(pkg)), summary);
}
contentTree.add(table);
content.add(table);
}
/**
* Add the class elements that use the given class.
*
* @param contentTree the content tree to which the class elements will be added
* @param content the content to which the class elements will be added
*/
protected void addClassList(Content contentTree) {
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList);
protected void addClassList(Content content) {
var ul = HtmlTree.UL(HtmlStyle.blockList);
for (PackageElement pkg : pkgSet) {
HtmlTree htmlTree = HtmlTree.SECTION(HtmlStyle.detail)
var section = HtmlTree.SECTION(HtmlStyle.detail)
.setId(htmlIds.forPackage(pkg));
Content link = contents.getContent("doclet.ClassUse_Uses.of.0.in.1",
getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.CLASS_USE_HEADER,
typeElement)),
getPackageLink(pkg, getLocalizedPackageName(pkg)));
Content heading = HtmlTree.HEADING(Headings.TypeUse.SUMMARY_HEADING, link);
htmlTree.add(heading);
addClassUse(pkg, htmlTree);
ul.add(HtmlTree.LI(htmlTree));
var heading = HtmlTree.HEADING(Headings.TypeUse.SUMMARY_HEADING, link);
section.add(heading);
addClassUse(pkg, section);
ul.add(HtmlTree.LI(section));
}
Content li = HtmlTree.SECTION(HtmlStyle.classUses, ul);
contentTree.add(li);
var li = HtmlTree.SECTION(HtmlStyle.classUses, ul);
content.add(li);
}
/**
@ -331,81 +331,81 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* Add the class use information.
*
* @param pkg the package that uses the given class
* @param contentTree the content tree to which the class use information will be added
* @param content the content to which the class use information will be added
*/
protected void addClassUse(PackageElement pkg, Content contentTree) {
protected void addClassUse(PackageElement pkg, Content content) {
Content classLink = getLink(new HtmlLinkInfo(configuration,
HtmlLinkInfo.Kind.CLASS_USE_HEADER, typeElement));
Content pkgLink = getPackageLink(pkg, getLocalizedPackageName(pkg));
classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg),
contents.getContent("doclet.ClassUse_Annotation", classLink,
pkgLink), contentTree);
pkgLink), content);
classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg),
contents.getContent("doclet.ClassUse_TypeParameter", classLink,
pkgLink), contentTree);
pkgLink), content);
classSubWriter.addUseInfo(pkgToSubclass.get(pkg),
contents.getContent("doclet.ClassUse_Subclass", classLink,
pkgLink), contentTree);
pkgLink), content);
classSubWriter.addUseInfo(pkgToSubinterface.get(pkg),
contents.getContent("doclet.ClassUse_Subinterface", classLink,
pkgLink), contentTree);
pkgLink), content);
classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg),
contents.getContent("doclet.ClassUse_ImplementingClass", classLink,
pkgLink), contentTree);
pkgLink), content);
fieldSubWriter.addUseInfo(pkgToField.get(pkg),
contents.getContent("doclet.ClassUse_Field", classLink,
pkgLink), contentTree);
pkgLink), content);
fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg),
contents.getContent("doclet.ClassUse_FieldAnnotations", classLink,
pkgLink), contentTree);
pkgLink), content);
fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg),
contents.getContent("doclet.ClassUse_FieldTypeParameter", classLink,
pkgLink), contentTree);
pkgLink), content);
methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg),
contents.getContent("doclet.ClassUse_MethodAnnotations", classLink,
pkgLink), contentTree);
pkgLink), content);
methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg),
contents.getContent("doclet.ClassUse_MethodParameterAnnotations", classLink,
pkgLink), contentTree);
pkgLink), content);
methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg),
contents.getContent("doclet.ClassUse_MethodTypeParameter", classLink,
pkgLink), contentTree);
pkgLink), content);
methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg),
contents.getContent("doclet.ClassUse_MethodReturn", classLink,
pkgLink), contentTree);
pkgLink), content);
methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg),
contents.getContent("doclet.ClassUse_MethodReturnTypeParameter", classLink,
pkgLink), contentTree);
pkgLink), content);
methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg),
contents.getContent("doclet.ClassUse_MethodArgs", classLink,
pkgLink), contentTree);
pkgLink), content);
methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg),
contents.getContent("doclet.ClassUse_MethodArgsTypeParameters", classLink,
pkgLink), contentTree);
pkgLink), content);
methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg),
contents.getContent("doclet.ClassUse_MethodThrows", classLink,
pkgLink), contentTree);
pkgLink), content);
constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg),
contents.getContent("doclet.ClassUse_ConstructorAnnotations", classLink,
pkgLink), contentTree);
pkgLink), content);
constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg),
contents.getContent("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
pkgLink), contentTree);
pkgLink), content);
constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg),
contents.getContent("doclet.ClassUse_ConstructorArgs", classLink,
pkgLink), contentTree);
pkgLink), content);
constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg),
contents.getContent("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
pkgLink), contentTree);
pkgLink), content);
constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg),
contents.getContent("doclet.ClassUse_ConstructorThrows", classLink,
pkgLink), contentTree);
pkgLink), content);
}
/**
* Get the header for the class use Listing.
* Get the header for the class use listing.
*
* @return a content tree representing the class use header
* @return the class use header
*/
protected HtmlTree getClassUseHeader() {
String cltype = resources.getText(switch (typeElement.getKind()) {
@ -418,16 +418,16 @@ public class ClassUseWriter extends SubWriterHolderWriter {
String clname = utils.getFullyQualifiedName(typeElement);
String title = resources.getText("doclet.Window_ClassUse_Header",
cltype, clname);
HtmlTree bodyTree = getBody(getWindowTitle(title));
HtmlTree body = getBody(getWindowTitle(title));
ContentBuilder headingContent = new ContentBuilder();
headingContent.add(contents.getContent("doclet.ClassUse_Title", cltype));
headingContent.add(new HtmlTree(TagName.BR));
headingContent.add(clname);
Content heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, headingContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
var div = HtmlTree.DIV(HtmlStyle.header, heading);
bodyContents.setHeader(getHeader(PageMode.USE, typeElement)).addMainContent(div);
return bodyTree;
return body;
}
@Override

View File

@ -99,12 +99,12 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
@Override
public Content getHeader(String header) {
HtmlTree bodyTree = getBody(getWindowTitle(utils.getSimpleName(typeElement)));
HtmlTree div = HtmlTree.DIV(HtmlStyle.header);
HtmlTree body = getBody(getWindowTitle(utils.getSimpleName(typeElement)));
var div = HtmlTree.DIV(HtmlStyle.header);
if (configuration.showModules) {
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInType, contents.moduleLabel);
Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
var classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInType, contents.moduleLabel);
var moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
moduleNameDiv.add(Entity.NO_BREAK_SPACE);
moduleNameDiv.add(getModuleLink(mdle,
Text.of(mdle.getQualifiedName())));
@ -112,8 +112,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
}
PackageElement pkg = utils.containingPackage(typeElement);
if (!pkg.isUnnamed()) {
Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInType, contents.packageLabel);
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
var classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInType, contents.packageLabel);
var pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
pkgNameDiv.add(Entity.NO_BREAK_SPACE);
Content pkgNameContent = getPackageLink(pkg, getLocalizedPackageName(pkg));
pkgNameDiv.add(pkgNameContent);
@ -123,14 +123,14 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
HtmlLinkInfo.Kind.CLASS_HEADER, typeElement);
//Let's not link to ourselves in the header.
linkInfo.linkToSelf = false;
Content heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, Text.of(header));
heading.add(getTypeParameterLinks(linkInfo));
div.add(heading);
bodyContents.setHeader(getHeader(PageMode.CLASS, typeElement))
.addMainContent(MarkerComments.START_OF_CLASS_DATA)
.addMainContent(div);
return bodyTree;
return body;
}
@Override
@ -164,23 +164,18 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
}
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
public void printDocument(Content content) throws DocFileIOException {
String description = getDescription("declaration", typeElement);
PackageElement pkg = utils.containingPackage(typeElement);
List<DocPath> localStylesheets = getLocalStylesheets(pkg);
contentTree.add(bodyContents);
content.add(bodyContents);
printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement),
description, localStylesheets, contentTree);
description, localStylesheets, content);
}
@Override
public Content getClassInfoTreeHeader() {
return getMemberTreeHeader();
}
@Override
public Content getClassInfo(Content classInfoTree) {
return getMemberTree(HtmlIds.CLASS_DESCRIPTION, HtmlStyle.classDescription, classInfoTree);
public Content getClassInfo(Content classInfo) {
return getMember(HtmlIds.CLASS_DESCRIPTION, HtmlStyle.classDescription, classInfo);
}
@Override
@ -189,51 +184,51 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
}
@Override
public void addClassSignature(Content classInfoTree) {
classInfoTree.add(new HtmlTree(TagName.HR));
classInfoTree.add(new Signatures.TypeSignature(typeElement, this)
public void addClassSignature(Content classInfo) {
classInfo.add(new HtmlTree(TagName.HR));
classInfo.add(new Signatures.TypeSignature(typeElement, this)
.toContent());
}
@Override
public void addClassDescription(Content classInfoTree) {
addPreviewInfo(classInfoTree);
public void addClassDescription(Content classInfo) {
addPreviewInfo(classInfo);
if (!options.noComment()) {
// generate documentation for the class.
if (!utils.getFullBody(typeElement).isEmpty()) {
addInlineComment(typeElement, classInfoTree);
addInlineComment(typeElement, classInfo);
}
}
}
private void addPreviewInfo(Content classInfoTree) {
addPreviewInfo(typeElement, classInfoTree);
private void addPreviewInfo(Content content) {
addPreviewInfo(typeElement, content);
}
@Override
public void addClassTagInfo(Content classInfoTree) {
public void addClassTagInfo(Content classInfo) {
if (!options.noComment()) {
// Print Information about all the tags here
addTagsInfo(typeElement, classInfoTree);
addTagsInfo(typeElement, classInfo);
}
}
/**
* Get the class hierarchy tree for the given class.
* Get the class inheritance tree for the given class.
*
* @param type the class to print the hierarchy for
* @return a content tree for class inheritance
* @param type the class to get the inheritance tree for
* @return the class inheritance tree
*/
private Content getClassInheritanceTree(TypeMirror type) {
private Content getClassInheritanceTreeContent(TypeMirror type) {
TypeMirror sup;
HtmlTree classTree = null;
do {
sup = utils.getFirstVisibleSuperClass(type);
HtmlTree htmlElement = HtmlTree.DIV(HtmlStyle.inheritance, getTreeForClassHelper(type));
var entry = HtmlTree.DIV(HtmlStyle.inheritance, getClassHelperContent(type));
if (classTree != null)
htmlElement.add(classTree);
classTree = htmlElement;
entry.add(classTree);
classTree = entry;
type = sup;
} while (sup != null);
classTree.put(HtmlAttr.TITLE, contents.getContent("doclet.Inheritance_Tree").toString());
@ -241,54 +236,54 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
}
/**
* Get the class helper tree for the given class.
* Get the class helper for the given class.
*
* @param type the class to print the helper for
* @return a content tree for class helper
* @param type the class to get the helper for
* @return the class helper
*/
private Content getTreeForClassHelper(TypeMirror type) {
Content content = new ContentBuilder();
private Content getClassHelperContent(TypeMirror type) {
Content result = new ContentBuilder();
if (utils.typeUtils.isSameType(type, typeElement.asType())) {
Content typeParameters = getTypeParameterLinks(
new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.TREE,
typeElement));
if (configuration.shouldExcludeQualifier(utils.containingPackage(typeElement).toString())) {
content.add(utils.asTypeElement(type).getSimpleName());
content.add(typeParameters);
result.add(utils.asTypeElement(type).getSimpleName());
result.add(typeParameters);
} else {
content.add(utils.asTypeElement(type).getQualifiedName());
content.add(typeParameters);
result.add(utils.asTypeElement(type).getQualifiedName());
result.add(typeParameters);
}
} else {
Content link = getLink(new HtmlLinkInfo(configuration,
HtmlLinkInfo.Kind.CLASS_TREE_PARENT, type)
.label(configuration.getClassName(utils.asTypeElement(type))));
content.add(link);
result.add(link);
}
return content;
return result;
}
@Override
public void addClassTree(Content classContentTree) {
public void addClassTree(Content target) {
if (!utils.isClass(typeElement)) {
return;
}
classContentTree.add(getClassInheritanceTree(typeElement.asType()));
target.add(getClassInheritanceTreeContent(typeElement.asType()));
}
@Override
public void addParamInfo(Content classInfoTree) {
public void addParamInfo(Content target) {
if (utils.hasBlockTag(typeElement, DocTree.Kind.PARAM)) {
Content paramInfo = (new ParamTaglet()).getAllBlockTagOutput(typeElement,
getTagletWriterInstance(false));
if (!paramInfo.isEmpty()) {
classInfoTree.add(HtmlTree.DL(HtmlStyle.notes, paramInfo));
target.add(HtmlTree.DL(HtmlStyle.notes, paramInfo));
}
}
}
@Override
public void addSubClassInfo(Content classInfoTree) {
public void addSubClassInfo(Content target) {
if (utils.isClass(typeElement)) {
for (String s : suppressSubtypesSet) {
if (typeElement.getQualifiedName().contentEquals(s)) {
@ -297,29 +292,29 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
}
Set<TypeElement> subclasses = classtree.directSubClasses(typeElement, false);
if (!subclasses.isEmpty()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(contents.subclassesLabel));
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.SUBCLASSES, subclasses)));
classInfoTree.add(dl);
target.add(dl);
}
}
}
@Override
public void addSubInterfacesInfo(Content classInfoTree) {
public void addSubInterfacesInfo(Content target) {
if (utils.isInterface(typeElement)) {
Set<TypeElement> subInterfaces = classtree.allSubClasses(typeElement, false);
if (!subInterfaces.isEmpty()) {
Content dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(contents.subinterfacesLabel));
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.SUBINTERFACES, subInterfaces)));
classInfoTree.add(dl);
target.add(dl);
}
}
}
@Override
public void addInterfaceUsageInfo (Content classInfoTree) {
public void addInterfaceUsageInfo(Content target) {
if (!utils.isInterface(typeElement)) {
return;
}
@ -330,67 +325,67 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
}
Set<TypeElement> implcl = classtree.implementingClasses(typeElement);
if (!implcl.isEmpty()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(contents.implementingClassesLabel));
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.IMPLEMENTED_CLASSES, implcl)));
classInfoTree.add(dl);
target.add(dl);
}
}
@Override
public void addImplementedInterfacesInfo(Content classInfoTree) {
public void addImplementedInterfacesInfo(Content target) {
SortedSet<TypeMirror> interfaces = new TreeSet<>(comparators.makeTypeMirrorClassUseComparator());
interfaces.addAll(utils.getAllInterfaces(typeElement));
if (utils.isClass(typeElement) && !interfaces.isEmpty()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(contents.allImplementedInterfacesLabel));
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.IMPLEMENTED_INTERFACES, interfaces)));
classInfoTree.add(dl);
target.add(dl);
}
}
@Override
public void addSuperInterfacesInfo(Content classInfoTree) {
public void addSuperInterfacesInfo(Content target) {
SortedSet<TypeMirror> interfaces =
new TreeSet<>(comparators.makeTypeMirrorIndexUseComparator());
interfaces.addAll(utils.getAllInterfaces(typeElement));
if (utils.isInterface(typeElement) && !interfaces.isEmpty()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(contents.allSuperinterfacesLabel));
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.SUPER_INTERFACES, interfaces)));
classInfoTree.add(dl);
target.add(dl);
}
}
@Override
public void addNestedClassInfo(final Content classInfoTree) {
public void addNestedClassInfo(final Content target) {
Element outerClass = typeElement.getEnclosingElement();
if (outerClass == null)
return;
new SimpleElementVisitor8<Void, Void>() {
@Override
public Void visitType(TypeElement e, Void p) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(utils.isInterface(e)
? contents.enclosingInterfaceLabel
: contents.enclosingClassLabel));
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.CLASS, List.of(e))));
classInfoTree.add(dl);
target.add(dl);
return null;
}
}.visit(outerClass);
}
@Override
public void addFunctionalInterfaceInfo (Content classInfoTree) {
public void addFunctionalInterfaceInfo (Content target) {
if (isFunctionalInterface()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(contents.functionalInterface));
Content dd = new HtmlTree(TagName.DD);
var dd = new HtmlTree(TagName.DD);
dd.add(contents.functionalInterfaceMessage);
dl.add(dd);
classInfoTree.add(dl);
target.add(dl);
}
}
@ -406,11 +401,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
@Override
public void addClassDeprecationInfo(Content classInfoTree) {
public void addClassDeprecationInfo(Content classInfo) {
List<? extends DeprecatedTree> deprs = utils.getDeprecatedTrees(typeElement);
if (utils.isDeprecated(typeElement)) {
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(typeElement));
Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
var deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(typeElement));
var div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
if (!deprs.isEmpty()) {
CommentHelper ch = utils.getCommentHelper(typeElement);
DocTree dt = deprs.get(0);
@ -419,16 +414,16 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
addInlineDeprecatedComment(typeElement, deprs.get(0), div);
}
}
classInfoTree.add(div);
classInfo.add(div);
}
}
/**
* Get links to the given classes.
* Get the links to the given classes.
*
* @param context the id of the context where the link will be printed
* @param list the list of classes
* @return a content tree for the class list
* @param context the id of the context where the links will be added
* @param list the classes
* @return the links
*/
private Content getClassLinks(HtmlLinkInfo.Kind context, Collection<?> list) {
Content content = new ContentBuilder();
@ -463,14 +458,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
return typeElement;
}
/**
* Get the member details tree
*
* @param contentTree the tree used to generate the member details tree
* @return a content tree for the member details
*/
public Content getMemberDetailsTree(Content contentTree) {
HtmlTree section = HtmlTree.SECTION(HtmlStyle.details, contentTree);
@Override
public Content getMemberDetails(Content content) {
var section = HtmlTree.SECTION(HtmlStyle.details, content);
// The following id is required by the Navigation bar
if (utils.isAnnotationType(typeElement)) {
section.setId(HtmlIds.ANNOTATION_TYPE_ELEMENT_DETAIL);

View File

@ -68,9 +68,9 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
private final TableHeader constantsTableHeader;
/**
* The HTML tree for constant values summary.
* The HTML tree for constant values summary currently being written.
*/
private HtmlTree summaryTree;
private HtmlTree summarySection;
private final BodyContents bodyContents = new BodyContents();
@ -91,9 +91,9 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
@Override
public Content getHeader() {
String label = resources.getText("doclet.Constants_Summary");
HtmlTree bodyTree = getBody(getWindowTitle(label));
HtmlTree body = getBody(getWindowTitle(label));
bodyContents.setHeader(getHeader(PageMode.CONSTANT_VALUES));
return bodyTree;
return body;
}
@Override
@ -103,7 +103,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
@Override
public void addLinkToPackageContent(PackageElement pkg,
Set<PackageElement> printedPackageHeaders, Content contentListTree) {
Set<PackageElement> printedPackageHeaders, Content content) {
//add link to summary
Content link;
if (pkg.isUnnamed()) {
@ -117,20 +117,20 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(pkg);
printedPackageHeaders.add(abbrevPkg);
}
contentListTree.add(HtmlTree.LI(link));
content.add(HtmlTree.LI(link));
}
@Override
public void addContentsList(Content contentListTree) {
public void addContentsList(Content content) {
Content titleContent = contents.constantsSummaryTitle;
Content pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, titleContent);
Content div = HtmlTree.DIV(HtmlStyle.header, pHeading);
var div = HtmlTree.DIV(HtmlStyle.header, pHeading);
Content headingContent = contents.contentsHeading;
Content heading = HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
var heading = HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
headingContent);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.packages, heading);
section.add(contentListTree);
var section = HtmlTree.SECTION(HtmlStyle.packages, heading);
section.add(content);
div.add(section);
bodyContents.addMainContent(div);
}
@ -141,11 +141,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
}
@Override
public void addPackageName(PackageElement pkg, Content summariesTree, boolean first) {
public void addPackageName(PackageElement pkg, Content toContent, boolean first) {
Content pkgNameContent;
HtmlId anchorName;
if (!first) {
summariesTree.add(summaryTree);
toContent.add(summarySection);
}
if (pkg.isUnnamed()) {
anchorName = HtmlIds.UNNAMED_PACKAGE_ANCHOR;
@ -155,11 +155,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
anchorName = htmlIds.forPackage(pkg);
pkgNameContent = getPackageLabel(parsedPackageName);
}
Content headingContent = Text.of(".*");
Content heading = HtmlTree.HEADING_TITLE(Headings.ConstantsSummary.PACKAGE_HEADING,
var headingContent = Text.of(".*");
var heading = HtmlTree.HEADING_TITLE(Headings.ConstantsSummary.PACKAGE_HEADING,
pkgNameContent);
heading.add(headingContent);
summaryTree = HtmlTree.SECTION(HtmlStyle.constantsSummary, heading)
summarySection = HtmlTree.SECTION(HtmlStyle.constantsSummary, heading)
.setId(anchorName);
}
@ -169,14 +169,14 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
}
@Override
public void addClassConstant(Content summariesTree, Content classConstantTree) {
summaryTree.add(classConstantTree);
public void addClassConstant(Content fromClassConstant) {
summarySection.add(fromClassConstant);
hasConstants = true;
}
@Override
public void addConstantMembers(TypeElement typeElement, Collection<VariableElement> fields,
Content classConstantTree) {
Content target) {
currentTypeElement = typeElement;
//generate links backward only to public classes.
@ -201,7 +201,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
for (VariableElement field : fields) {
table.addRow(getTypeColumn(field), getNameColumn(field), getValue(field));
}
classConstantTree.add(HtmlTree.LI(table));
target.add(HtmlTree.LI(table));
}
/**
@ -212,7 +212,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
*/
private Content getTypeColumn(VariableElement member) {
Content typeContent = new ContentBuilder();
Content code = new HtmlTree(TagName.CODE)
var code = new HtmlTree(TagName.CODE)
.setId(htmlIds.forMember(currentTypeElement, member));
for (Modifier mod : member.getModifiers()) {
code.add(Text.of(mod.toString()))
@ -249,11 +249,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
}
@Override
public void addConstantSummaries(Content summariesTree) {
if (summaryTree != null) {
summariesTree.add(summaryTree);
public void addConstantSummaries(Content content) {
if (summarySection != null) {
content.add(summarySection);
}
bodyContents.addMainContent(summariesTree);
bodyContents.addMainContent(content);
}
@Override
@ -262,9 +262,9 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
}
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
contentTree.add(bodyContents);
printHtmlDocument(null, "summary of constants", contentTree);
public void printDocument(Content content) throws DocFileIOException {
content.add(bodyContents);
printHtmlDocument(null, "summary of constants", content);
if (hasConstants && configuration.mainIndex != null) {
configuration.mainIndex.add(IndexItem.of(IndexItem.Category.TAGS,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -90,11 +90,11 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
@Override
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_CONSTRUCTOR_SUMMARY);
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;
Content content) {
content.add(MarkerComments.START_OF_CONSTRUCTOR_SUMMARY);
Content c = new ContentBuilder();
writer.addSummaryHeader(this, c);
return c;
}
@Override
@ -104,26 +104,26 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public Content getConstructorDetailsTreeHeader(Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_CONSTRUCTOR_DETAILS);
Content constructorDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
public Content getConstructorDetailsHeader(Content content) {
content.add(MarkerComments.START_OF_CONSTRUCTOR_DETAILS);
Content constructorDetails = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.constructorDetailsLabel);
constructorDetailsTree.add(heading);
return constructorDetailsTree;
constructorDetails.add(heading);
return constructorDetails;
}
@Override
public Content getConstructorDocTreeHeader(ExecutableElement constructor) {
Content constructorDocTree = new ContentBuilder();
HtmlTree heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
public Content getConstructorHeaderContent(ExecutableElement constructor) {
Content content = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
Text.of(name(constructor)));
HtmlId erasureAnchor = htmlIds.forErasure(constructor);
if (erasureAnchor != null) {
heading.setId(erasureAnchor);
}
constructorDocTree.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, constructorDocTree)
content.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, content)
.setId(htmlIds.forMember(constructor));
}
@ -137,32 +137,32 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public void addDeprecated(ExecutableElement constructor, Content constructorDocTree) {
addDeprecatedInfo(constructor, constructorDocTree);
public void addDeprecated(ExecutableElement constructor, Content constructorContent) {
addDeprecatedInfo(constructor, constructorContent);
}
@Override
public void addPreview(ExecutableElement constructor, Content constructorDocTree) {
addPreviewInfo(constructor, constructorDocTree);
public void addPreview(ExecutableElement constructor, Content content) {
addPreviewInfo(constructor, content);
}
@Override
public void addComments(ExecutableElement constructor, Content constructorDocTree) {
addComment(constructor, constructorDocTree);
public void addComments(ExecutableElement constructor, Content constructorContent) {
addComment(constructor, constructorContent);
}
@Override
public void addTags(ExecutableElement constructor, Content constructorDocTree) {
writer.addTagsInfo(constructor, constructorDocTree);
public void addTags(ExecutableElement constructor, Content constructorContent) {
writer.addTagsInfo(constructor, constructorContent);
}
@Override
public Content getConstructorDetails(Content constructorDetailsTreeHeader, Content constructorDetailsTree) {
public Content getConstructorDetails(Content memberDetailsHeader, Content memberDetails) {
return writer.getDetailsListItem(
HtmlTree.SECTION(HtmlStyle.constructorDetails)
.setId(HtmlIds.CONSTRUCTOR_DETAIL)
.add(constructorDetailsTreeHeader)
.add(constructorDetailsTree));
.add(memberDetailsHeader)
.add(memberDetails));
}
@Override
@ -171,10 +171,10 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
public void addSummaryLabel(Content content) {
var label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
contents.constructorSummaryLabel);
memberTree.add(label);
content.add(label);
}
@Override
@ -206,13 +206,13 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
public void addInheritedSummaryLabel(TypeElement typeElement, Content content) {
}
@Override
protected void addSummaryType(Element member, Content tdSummaryType) {
protected void addSummaryType(Element member, Content content) {
if (foundNonPubConstructor) {
Content code = new HtmlTree(TagName.CODE);
var code = new HtmlTree(TagName.CODE);
if (utils.isProtected(member)) {
code.add("protected ");
} else if (utils.isPrivate(member)) {
@ -223,12 +223,12 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
code.add(
resources.getText("doclet.Package_private"));
}
tdSummaryType.add(code);
content.add(code);
}
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
public Content getMemberHeader(){
return writer.getMemberHeader();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022, 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
@ -343,7 +343,7 @@ public class Contents {
* a given key in the doclet's resources.
*
* @param key the key for the desired string
* @return a content tree for the string
* @return the string
*/
public Content getContent(String key) {
return Text.of(resources.getText(key));
@ -356,7 +356,7 @@ public class Contents {
*
* @param key the key for the desired string
* @param o0 string or content argument to be formatted into the result
* @return a content tree for the text
* @return the string
*/
public Content getContent(String key, Object o0) {
return getContent(key, o0, null, null);
@ -370,7 +370,7 @@ public class Contents {
* @param key the key for the desired string
* @param o0 string or content argument to be formatted into the result
* @param o1 string or content argument to be formatted into the result
* @return a content tree for the text
* @return the string
*/
public Content getContent(String key, Object o0, Object o1) {
return getContent(key, o0, o1, null);
@ -385,7 +385,7 @@ public class Contents {
* @param o0 string or content argument to be formatted into the result
* @param o1 string or content argument to be formatted into the result
* @param o2 string or content argument to be formatted into the result
* @return a content tree for the text
* @return the string
*/
public Content getContent(String key, Object o0, Object o1, Object o2) {
Content c = new ContentBuilder();
@ -423,7 +423,7 @@ public class Contents {
*
* @param separator the separator
* @param items the items
* @return the content
* @return the composition
*/
public Content join(Content separator, Collection<Content> items) {
Content result = new ContentBuilder();
@ -446,7 +446,7 @@ public class Contents {
* the named resource string.
*
* @param key the key for the desired string
* @return a content tree for the string
* @return the string
*/
private Content getNonBreakResource(String key) {
return getNonBreakString(resources.getText(key));
@ -458,7 +458,7 @@ public class Contents {
* the named resource string.
*
* @param text the string
* @return a content tree for the string
* @return the string content
*/
public Content getNonBreakString(String text) {
Content c = new ContentBuilder();
@ -474,9 +474,9 @@ public class Contents {
}
/**
* Returns a content for a visible member kind.
* {@return a label that describes the VisibleMemberTable kind}
*
* @param kind the visible member table kind.
* @return the string content
*/
public Content getNavLinkLabelContent(VisibleMemberTable.Kind kind) {
return Objects.requireNonNull(navLinkLabels.get(kind));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -59,11 +59,11 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
@Override
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_ENUM_CONSTANT_SUMMARY);
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;
Content content) {
content.add(MarkerComments.START_OF_ENUM_CONSTANT_SUMMARY);
Content memberContent = new ContentBuilder();
writer.addSummaryHeader(this, memberContent);
return memberContent;
}
@Override
@ -73,24 +73,24 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
}
@Override
public Content getEnumConstantsDetailsTreeHeader(TypeElement typeElement,
Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_ENUM_CONSTANT_DETAILS);
Content enumConstantsDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
public Content getEnumConstantsDetailsHeader(TypeElement typeElement,
Content memberDetails) {
memberDetails.add(MarkerComments.START_OF_ENUM_CONSTANT_DETAILS);
var enumConstantsDetailsContent = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.enumConstantDetailLabel);
enumConstantsDetailsTree.add(heading);
return enumConstantsDetailsTree;
enumConstantsDetailsContent.add(heading);
return enumConstantsDetailsContent;
}
@Override
public Content getEnumConstantsTreeHeader(VariableElement enumConstant,
Content enumConstantsDetailsTree) {
Content enumConstantsTree = new ContentBuilder();
HtmlTree heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
public Content getEnumConstantsHeader(VariableElement enumConstant,
Content enumConstantsDetails) {
Content enumConstantsContent = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
Text.of(name(enumConstant)));
enumConstantsTree.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, enumConstantsTree)
enumConstantsContent.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, enumConstantsContent)
.setId(htmlIds.forMember(enumConstant));
}
@ -103,40 +103,40 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
}
@Override
public void addDeprecated(VariableElement enumConstant, Content enumConstantsTree) {
addDeprecatedInfo(enumConstant, enumConstantsTree);
public void addDeprecated(VariableElement enumConstant, Content content) {
addDeprecatedInfo(enumConstant, content);
}
@Override
public void addPreview(VariableElement enumConstant, Content enumConstantsTree) {
addPreviewInfo(enumConstant, enumConstantsTree);
public void addPreview(VariableElement enumConstant, Content content) {
addPreviewInfo(enumConstant, content);
}
@Override
public void addComments(VariableElement enumConstant, Content enumConstantsTree) {
addComment(enumConstant, enumConstantsTree);
public void addComments(VariableElement enumConstant, Content enumConstants) {
addComment(enumConstant, enumConstants);
}
@Override
public void addTags(VariableElement enumConstant, Content enumConstantsTree) {
writer.addTagsInfo(enumConstant, enumConstantsTree);
public void addTags(VariableElement enumConstant, Content content) {
writer.addTagsInfo(enumConstant, content);
}
@Override
public Content getEnumConstantsDetails(Content enumConstantsDetailsTreeHeader,
Content enumConstantsDetailsTree) {
public Content getEnumConstantsDetails(Content memberDetailsHeader,
Content content) {
return writer.getDetailsListItem(
HtmlTree.SECTION(HtmlStyle.constantDetails)
.setId(HtmlIds.ENUM_CONSTANT_DETAIL)
.add(enumConstantsDetailsTreeHeader)
.add(enumConstantsDetailsTree));
.add(memberDetailsHeader)
.add(content));
}
@Override
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
public void addSummaryLabel(Content content) {
var label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
contents.enumConstantSummary);
memberTree.add(label);
content.add(label);
}
@Override
@ -153,24 +153,24 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
}
@Override
public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
public void addInheritedSummaryLabel(TypeElement typeElement, Content content) {
}
@Override
protected void addSummaryLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Element member,
Content tdSummary) {
Content content) {
Content memberLink = writer.getDocLink(context, utils.getEnclosingTypeElement(member), member,
name(member), HtmlStyle.memberNameLink);
Content code = HtmlTree.CODE(memberLink);
tdSummary.add(code);
var code = HtmlTree.CODE(memberLink);
content.add(code);
}
@Override
protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content linksTree) {
protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content target) {
}
@Override
protected void addSummaryType(Element member, Content tdSummaryType) {
protected void addSummaryType(Element member, Content content) {
//Not applicable.
}
@ -181,7 +181,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
public Content getMemberHeader(){
return writer.getMemberHeader();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -62,11 +62,11 @@ public class FieldWriterImpl extends AbstractMemberWriter
@Override
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_FIELD_SUMMARY);
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;
Content content) {
content.add(MarkerComments.START_OF_FIELD_SUMMARY);
Content memberContent = new ContentBuilder();
writer.addSummaryHeader(this, memberContent);
return memberContent;
}
@Override
@ -76,22 +76,22 @@ public class FieldWriterImpl extends AbstractMemberWriter
}
@Override
public Content getFieldDetailsTreeHeader(Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_FIELD_DETAILS);
Content fieldDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
public Content getFieldDetailsHeader(Content content) {
content.add(MarkerComments.START_OF_FIELD_DETAILS);
Content fieldDetailsContent = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.fieldDetailsLabel);
fieldDetailsTree.add(heading);
return fieldDetailsTree;
fieldDetailsContent.add(heading);
return fieldDetailsContent;
}
@Override
public Content getFieldDocTreeHeader(VariableElement field) {
Content fieldTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
public Content getFieldHeaderContent(VariableElement field) {
Content content = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
Text.of(name(field)));
fieldTree.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, fieldTree)
content.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, content)
.setId(htmlIds.forMember(field));
}
@ -104,41 +104,41 @@ public class FieldWriterImpl extends AbstractMemberWriter
}
@Override
public void addDeprecated(VariableElement field, Content fieldTree) {
addDeprecatedInfo(field, fieldTree);
public void addDeprecated(VariableElement field, Content fieldContent) {
addDeprecatedInfo(field, fieldContent);
}
@Override
public void addPreview(VariableElement field, Content fieldTree) {
addPreviewInfo(field, fieldTree);
public void addPreview(VariableElement field, Content content) {
addPreviewInfo(field, content);
}
@Override
public void addComments(VariableElement field, Content fieldTree) {
public void addComments(VariableElement field, Content fieldContent) {
if (!utils.getFullBody(field).isEmpty()) {
writer.addInlineComment(field, fieldTree);
writer.addInlineComment(field, fieldContent);
}
}
@Override
public void addTags(VariableElement field, Content fieldTree) {
writer.addTagsInfo(field, fieldTree);
public void addTags(VariableElement field, Content fieldContent) {
writer.addTagsInfo(field, fieldContent);
}
@Override
public Content getFieldDetails(Content fieldDetailsTreeHeader, Content fieldDetailsTree) {
public Content getFieldDetails(Content memberDetailsHeaderContent, Content memberContent) {
return writer.getDetailsListItem(
HtmlTree.SECTION(HtmlStyle.fieldDetails)
.setId(HtmlIds.FIELD_DETAIL)
.add(fieldDetailsTreeHeader)
.add(fieldDetailsTree));
.add(memberDetailsHeaderContent)
.add(memberContent));
}
@Override
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
public void addSummaryLabel(Content content) {
var label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
contents.fieldSummaryLabel);
memberTree.add(label);
content.add(label);
}
@Override
@ -159,7 +159,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
}
@Override
public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
public void addInheritedSummaryLabel(TypeElement typeElement, Content content) {
Content classLink = writer.getPreQualifiedClassLink(
HtmlLinkInfo.Kind.MEMBER, typeElement);
Content label;
@ -172,32 +172,32 @@ public class FieldWriterImpl extends AbstractMemberWriter
? resources.getText("doclet.Fields_Inherited_From_Class")
: resources.getText("doclet.Fields_Inherited_From_Interface"));
}
HtmlTree labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING,
var labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING,
label);
labelHeading.setId(htmlIds.forInheritedFields(typeElement));
labelHeading.add(Entity.NO_BREAK_SPACE);
labelHeading.add(classLink);
inheritedTree.add(labelHeading);
content.add(labelHeading);
}
@Override
protected void addSummaryLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Element member,
Content tdSummary) {
Content content) {
Content memberLink = writer.getDocLink(context, typeElement , member, name(member),
HtmlStyle.memberNameLink);
Content code = HtmlTree.CODE(memberLink);
tdSummary.add(code);
var code = HtmlTree.CODE(memberLink);
content.add(code);
}
@Override
protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content linksTree) {
linksTree.add(
protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content target) {
target.add(
writer.getDocLink(HtmlLinkInfo.Kind.MEMBER, typeElement, member, name(member)));
}
@Override
protected void addSummaryType(Element member, Content tdSummaryType) {
addModifierAndType(member, utils.asInstantiatedFieldType(typeElement, (VariableElement)member), tdSummaryType);
protected void addSummaryType(Element member, Content content) {
addModifiersAndType(member, utils.asInstantiatedFieldType(typeElement, (VariableElement)member), content);
}
@Override
@ -207,7 +207,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
public Content getMemberHeader(){
return writer.getMemberHeader();
}
}

View File

@ -117,8 +117,8 @@ public class HelpWriter extends HtmlDocletWriter {
}
/**
* Adds the help file contents from the resource file to the content tree. While adding the
* help file contents it also keeps track of user options.
* Adds the help file contents from the resource file to the content.
* While adding the help file contents it also keeps track of user options.
*
* The general organization is:
* <ul>
@ -127,10 +127,10 @@ public class HelpWriter extends HtmlDocletWriter {
* <li>Page-specific help
* </ul>
*/
protected void addHelpFileContents(Content contentTree) {
HtmlTree mainTOC = HtmlTree.UL(HtmlStyle.helpTOC);
protected void addHelpFileContents(Content content) {
var mainTOC = HtmlTree.UL(HtmlStyle.helpTOC);
contentTree.add(HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.title,
content.add(HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.title,
getContent("doclet.help.main_heading")))
.add(mainTOC)
.add(new HtmlTree(TagName.HR))
@ -168,7 +168,7 @@ public class HelpWriter extends HtmlDocletWriter {
Content content = new ContentBuilder();
Content navHeading = contents.getContent("doclet.help.navigation.head");
HtmlTree navSection = HtmlTree.DIV(HtmlStyle.subTitle)
var navSection = HtmlTree.DIV(HtmlStyle.subTitle)
.add(HtmlTree.HEADING(Headings.CONTENT_HEADING, navHeading).setId(HtmlIds.HELP_NAVIGATION))
.add(contents.getContent("doclet.help.navigation.intro", overviewLink));
if (options.createIndex()) {
@ -183,24 +183,24 @@ public class HelpWriter extends HtmlDocletWriter {
}
content.add(navSection);
HtmlTree subTOC = HtmlTree.UL(HtmlStyle.helpSubTOC);
var subTOC = HtmlTree.UL(HtmlStyle.helpSubTOC);
HtmlTree section;
// Search
if (options.createIndex()) {
section = newHelpSection(getContent("doclet.help.search.head"), subTOC, HtmlIds.HELP_SEARCH);
Content searchIntro = HtmlTree.P(getContent("doclet.help.search.intro"));
Content searchExamples = HtmlTree.UL(HtmlStyle.helpSectionList);
var searchIntro = HtmlTree.P(getContent("doclet.help.search.intro"));
var searchExamples = HtmlTree.UL(HtmlStyle.helpSectionList);
for (String[] example : SEARCH_EXAMPLES) {
searchExamples.add(HtmlTree.LI(
getContent("doclet.help.search.example",
HtmlTree.CODE(Text.of(example[0])), example[1])));
}
Content searchSpecLink = HtmlTree.A(
var searchSpecLink = HtmlTree.A(
resources.getText("doclet.help.search.spec.url", configuration.getDocletVersion().feature()),
getContent("doclet.help.search.spec.title"));
Content searchRefer = HtmlTree.P(getContent("doclet.help.search.refer", searchSpecLink));
var searchRefer = HtmlTree.P(getContent("doclet.help.search.refer", searchSpecLink));
section.add(searchIntro)
.add(searchExamples)
.add(searchRefer);
@ -234,11 +234,11 @@ public class HelpWriter extends HtmlDocletWriter {
*/
private Content getPageKindSection(HtmlTree mainTOC) {
Content pageKindsHeading = contents.getContent("doclet.help.page_kinds.head");
HtmlTree pageKindsSection = HtmlTree.DIV(HtmlStyle.subTitle)
var pageKindsSection = HtmlTree.DIV(HtmlStyle.subTitle)
.add(HtmlTree.HEADING(Headings.CONTENT_HEADING, pageKindsHeading).setId(HtmlIds.HELP_PAGES))
.add(contents.getContent("doclet.help.page_kinds.intro"));
HtmlTree subTOC = HtmlTree.UL(HtmlStyle.helpSubTOC);
var subTOC = HtmlTree.UL(HtmlStyle.helpSubTOC);
HtmlTree section;
@ -256,7 +256,7 @@ public class HelpWriter extends HtmlDocletWriter {
if (configuration.showModules) {
section = newHelpSection(contents.moduleLabel, PageMode.MODULE, subTOC);
Content moduleIntro = getContent("doclet.help.module.intro");
Content modulePara = HtmlTree.P(moduleIntro);
var modulePara = HtmlTree.P(moduleIntro);
section.add(modulePara)
.add(newHelpSectionList(
contents.packagesLabel,
@ -451,7 +451,7 @@ public class HelpWriter extends HtmlDocletWriter {
}
private HtmlTree newHelpSectionList(Content first, Content... rest) {
HtmlTree list = HtmlTree.UL(HtmlStyle.helpSectionList, HtmlTree.LI(first));
var list = HtmlTree.UL(HtmlStyle.helpSectionList, HtmlTree.LI(first));
List.of(rest).forEach(i -> list.add(HtmlTree.LI(i)));
return list;
}

View File

@ -291,7 +291,7 @@ public class HtmlDocletWriter {
* Add method information.
*
* @param method the method to be documented
* @param dl the content tree to which the method information will be added
* @param dl the content to which the method information will be added
*/
private void addMethodInfo(ExecutableElement method, Content dl) {
TypeElement enclosing = utils.getEnclosingTypeElement(method);
@ -318,19 +318,19 @@ public class HtmlDocletWriter {
* Adds the tags information.
*
* @param e the Element for which the tags will be generated
* @param htmlTree the documentation tree to which the tags will be added
* @param content the content to which the tags will be added
*/
protected void addTagsInfo(Element e, Content htmlTree) {
protected void addTagsInfo(Element e, Content content) {
if (options.noComment()) {
return;
}
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
if (utils.isExecutableElement(e) && !utils.isConstructor(e)) {
addMethodInfo((ExecutableElement)e, dl);
}
Content output = getBlockTagOutput(e);
dl.add(output);
htmlTree.add(dl);
content.add(dl);
}
/**
@ -389,7 +389,7 @@ public class HtmlDocletWriter {
/**
* Returns a TagletWriter that knows how to write HTML.
*
* @param context the enclosing context for the trees
* @param context the enclosing context
* @return a TagletWriter
*/
public TagletWriter getTagletWriterInstance(TagletWriterImpl.Context context) {
@ -484,7 +484,7 @@ public class HtmlDocletWriter {
/**
* Returns a {@code <header>} element, containing the user "top" text, if any,
* amd the main navigation bar.
* and the main navigation bar.
*
* @param pageMode the pageMode used to configure the navigation bar
*
@ -496,7 +496,7 @@ public class HtmlDocletWriter {
/**
* Returns a {@code <header>} element, containing the user "top" text, if any,
* amd the main navigation bar.
* and the main navigation bar.
*
* @param pageMode the page mode used to configure the navigation bar
* @param element the element used to configure the navigation bar
@ -541,24 +541,24 @@ public class HtmlDocletWriter {
}
/**
* Get the overview tree link for the main tree.
* {@return an "overview tree" link for a navigation bar}
*
* @param label the label for the link
* @return a content tree for the link
*/
protected Content getNavLinkMainTree(String label) {
Content mainTreeContent = links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE),
protected Content getNavLinkToOverviewTree(String label) {
Content link = links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE),
Text.of(label));
return HtmlTree.LI(mainTreeContent);
return HtmlTree.LI(link);
}
/**
* Returns a content object containing the package name. A localized content object is
* returned for an unnamed package. Use {@link Utils#getPackageName(PackageElement)} to
* get a static string for the unnamed package instead.
* {@return a package name}
*
* @param packageElement the package to check
* @return package name content
* A localized name is returned for an unnamed package.
* Use {@link Utils#getPackageName(PackageElement)} to get a static string
* for the unnamed package instead.
*
* @param packageElement the package to get the name for
*/
public Content getLocalizedPackageName(PackageElement packageElement) {
return packageElement == null || packageElement.isUnnamed()
@ -600,11 +600,10 @@ public class HtmlDocletWriter {
}
/**
* Return the link to the given package.
* {@return the link to the given package}
*
* @param packageElement the package to link to.
* @param label the label for the link.
* @return a content tree for the package link.
*/
public Content getPackageLink(PackageElement packageElement, Content label) {
boolean included = packageElement != null && utils.isIncluded(packageElement);
@ -649,11 +648,10 @@ public class HtmlDocletWriter {
}
/**
* Get Module link.
* {@return a link to module}
*
* @param mdle the module being documented
* @param label tag for the link
* @return a content for the module link
*/
public Content getModuleLink(ModuleElement mdle, Content label) {
Set<ElementFlag> flags = mdle != null ? utils.elementFlags(mdle)
@ -681,13 +679,13 @@ public class HtmlDocletWriter {
}
/**
* Add the link to the content tree.
* Add the link to the content.
*
* @param element program element for which the link will be added
* @param label label for the link
* @param htmltree the content tree to which the link will be added
* @param target the content to which the link will be added
*/
public void addSrcLink(Element element, Content label, Content htmltree) {
public void addSrcLink(Element element, Content label, Content target) {
if (element == null) {
return;
}
@ -702,9 +700,9 @@ public class HtmlDocletWriter {
.resolve(docPaths.forClass(te));
Content content = links.createLink(href
.fragment(SourceToHTMLConverter.getAnchorName(utils, element).name()), label, "");
htmltree.add(content);
target.add(content);
} else {
htmltree.add(label);
target.add(label);
}
}
@ -782,11 +780,10 @@ public class HtmlDocletWriter {
}
/**
* Get the class link.
* {@return a link to the given class}
*
* @param context the id of the context where the link will be added
* @param element to link to
* @return a content tree for the link
* @param element the class to link to
*/
public Content getQualifiedClassLink(HtmlLinkInfo.Kind context, Element element) {
HtmlLinkInfo htmlLinkInfo = new HtmlLinkInfo(configuration, context, (TypeElement)element);
@ -794,14 +791,14 @@ public class HtmlDocletWriter {
}
/**
* Add the class link.
* Adds a link to the given class.
*
* @param context the id of the context where the link will be added
* @param typeElement to link to
* @param contentTree the content tree to which the link will be added
* @param typeElement the class to link to
* @param target the content to which the link will be added
*/
public void addPreQualifiedClassLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Content contentTree) {
addPreQualifiedClassLink(context, typeElement, null, contentTree);
public void addPreQualifiedClassLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Content target) {
addPreQualifiedClassLink(context, typeElement, null, target);
}
/**
@ -831,19 +828,19 @@ public class HtmlDocletWriter {
* @param context the id of the context where the link will be added
* @param typeElement the class to link to
* @param style optional style for the link
* @param contentTree the content tree to which the link with be added
* @param target the content to which the link with be added
*/
public void addPreQualifiedClassLink(HtmlLinkInfo.Kind context,
TypeElement typeElement, HtmlStyle style, Content contentTree) {
TypeElement typeElement, HtmlStyle style, Content target) {
PackageElement pkg = utils.containingPackage(typeElement);
if(pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) {
contentTree.add(getEnclosingPackageName(typeElement));
target.add(getEnclosingPackageName(typeElement));
}
HtmlLinkInfo linkinfo = new HtmlLinkInfo(configuration, context, typeElement)
.label(utils.getSimpleName(typeElement))
.style(style);
Content link = getLink(linkinfo);
contentTree.add(link);
target.add(link);
}
/**
@ -873,19 +870,18 @@ public class HtmlDocletWriter {
*
* @param context the id of the context where the link will be added
* @param typeElement the class to link to
* @param contentTree the content tree to which the link with be added
* @param content the content to which the link with be added
*/
public void addPreQualifiedStrongClassLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Content contentTree) {
addPreQualifiedClassLink(context, typeElement, HtmlStyle.typeNameLink, contentTree);
public void addPreQualifiedStrongClassLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Content content) {
addPreQualifiedClassLink(context, typeElement, HtmlStyle.typeNameLink, content);
}
/**
* Get the link for the given member.
* {@return a link to the given member}
*
* @param context the id of the context where the link will be added
* @param element the member being linked to
* @param label the label for the link
* @return a content tree for the element link
*/
public Content getDocLink(HtmlLinkInfo.Kind context, Element element, CharSequence label) {
return getDocLink(context, utils.getEnclosingTypeElement(element), element,
@ -1283,21 +1279,21 @@ public class HtmlDocletWriter {
*
* @param element the Element for which the inline comment will be added
* @param tag the inline tag to be added
* @param htmltree the content tree to which the comment will be added
* @param target the content to which the comment will be added
*/
public void addInlineComment(Element element, DocTree tag, Content htmltree) {
public void addInlineComment(Element element, DocTree tag, Content target) {
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> description = ch.getDescription(tag);
addCommentTags(element, description, false, false, false, htmltree);
addCommentTags(element, description, false, false, false, target);
}
/**
* Get the deprecated phrase as content.
* {@return a phrase describing the type of deprecation}
*
* @param e the Element for which the inline deprecated comment will be added
* @return a content tree for the deprecated phrase.
*/
public Content getDeprecatedPhrase(Element e) {
// TODO e should be checked to being deprecated
return (utils.isDeprecatedForRemoval(e))
? contents.deprecatedForRemovalPhrase
: contents.deprecatedPhrase;
@ -1308,21 +1304,21 @@ public class HtmlDocletWriter {
*
* @param e the Element for which the inline deprecated comment will be added
* @param tag the inline tag to be added
* @param htmltree the content tree to which the comment will be added
* @param target the content to which the comment will be added
*/
public void addInlineDeprecatedComment(Element e, DeprecatedTree tag, Content htmltree) {
public void addInlineDeprecatedComment(Element e, DeprecatedTree tag, Content target) {
CommentHelper ch = utils.getCommentHelper(e);
addCommentTags(e, ch.getBody(tag), true, false, false, htmltree);
addCommentTags(e, ch.getBody(tag), true, false, false, target);
}
/**
* Adds the summary content.
*
* @param element the Element for which the summary will be generated
* @param htmltree the documentation tree to which the summary will be added
* @param target the content to which the summary will be added
*/
public void addSummaryComment(Element element, Content htmltree) {
addSummaryComment(element, utils.getFirstSentenceTrees(element), htmltree);
public void addSummaryComment(Element element, Content target) {
addSummaryComment(element, utils.getFirstSentenceTrees(element), target);
}
/**
@ -1330,10 +1326,10 @@ public class HtmlDocletWriter {
*
* @param element the Element for which the summary will be generated
* @param firstSentenceTags the first sentence tags for the doc
* @param htmltree the documentation tree to which the summary will be added
* @param target the content to which the summary will be added
*/
public void addPreviewComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) {
addCommentTags(element, firstSentenceTags, false, true, true, htmltree);
public void addPreviewComment(Element element, List<? extends DocTree> firstSentenceTags, Content target) {
addCommentTags(element, firstSentenceTags, false, true, true, target);
}
/**
@ -1341,26 +1337,26 @@ public class HtmlDocletWriter {
*
* @param element the Element for which the summary will be generated
* @param firstSentenceTags the first sentence tags for the doc
* @param htmltree the documentation tree to which the summary will be added
* @param target the content to which the summary will be added
*/
public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) {
addCommentTags(element, firstSentenceTags, false, true, true, htmltree);
public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content target) {
addCommentTags(element, firstSentenceTags, false, true, true, target);
}
public void addSummaryDeprecatedComment(Element element, DeprecatedTree tag, Content htmltree) {
public void addSummaryDeprecatedComment(Element element, DeprecatedTree tag, Content target) {
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> body = ch.getBody(tag);
addCommentTags(element, ch.getFirstSentenceTrees(body), true, true, true, htmltree);
addCommentTags(element, ch.getFirstSentenceTrees(body), true, true, true, target);
}
/**
* Adds the full-body content of the given element.
*
* @param element the element for which the content will be added
* @param htmltree the documentation tree to which the content will be added
* @param target the content to which the content will be added
*/
public void addInlineComment(Element element, Content htmltree) {
addCommentTags(element, utils.getFullBody(element), false, false, false, htmltree);
public void addInlineComment(Element element, Content target) {
addCommentTags(element, utils.getFullBody(element), false, false, false, target);
}
/**
@ -1371,10 +1367,10 @@ public class HtmlDocletWriter {
* @param depr true if it is deprecated
* @param first true if the first sentence tags should be added
* @param inSummary true if the comment tags are added into the summary section
* @param htmltree the documentation tree to which the comment tags will be added
* @param target the content to which the comment tags will be added
*/
private void addCommentTags(Element element, List<? extends DocTree> tags, boolean depr,
boolean first, boolean inSummary, Content htmltree) {
boolean first, boolean inSummary, Content target) {
if (options.noComment()) {
return;
}
@ -1382,13 +1378,13 @@ public class HtmlDocletWriter {
Content result = commentTagsToContent(null, element, tags, first, inSummary);
if (depr) {
div = HtmlTree.DIV(HtmlStyle.deprecationComment, result);
htmltree.add(div);
target.add(div);
} else {
div = HtmlTree.DIV(HtmlStyle.block, result);
htmltree.add(div);
target.add(div);
}
if (tags.isEmpty()) {
htmltree.add(Entity.NO_BREAK_SPACE);
target.add(Entity.NO_BREAK_SPACE);
}
}
@ -1906,35 +1902,33 @@ public class HtmlDocletWriter {
}
/**
* Return a content tree containing the annotation types for the given element.
* {@return the annotation types info for the given element}
*
* @param element an Element
* @param lineBreak if true add new line between each member value
* @return the documentation tree containing the annotation info
*/
Content getAnnotationInfo(Element element, boolean lineBreak) {
return getAnnotationInfo(element.getAnnotationMirrors(), lineBreak);
}
/**
* Return a content tree containing the annotation types for the given element.
* {@return the description for the given annotations}
*
* @param descList a list of annotation mirrors
* @param lineBreak if true add new line between each member value
* @return the documentation tree containing the annotation info
*/
Content getAnnotationInfo(List<? extends AnnotationMirror> descList, boolean lineBreak) {
List<Content> annotations = getAnnotations(descList, lineBreak);
String sep = "";
ContentBuilder builder = new ContentBuilder();
ContentBuilder result = new ContentBuilder();
for (Content annotation: annotations) {
builder.add(sep);
builder.add(annotation);
result.add(sep);
result.add(annotation);
if (!lineBreak) {
sep = " ";
}
}
return builder;
return result;
}
/**
@ -2248,19 +2242,19 @@ public class HtmlDocletWriter {
}
/**
* Returns an HtmlTree for the BODY tag.
* Returns an HtmlTree for the BODY element.
*
* @param title title for the window
* @return an HtmlTree for the BODY tag
*/
public HtmlTree getBody(String title) {
HtmlTree body = new HtmlTree(TagName.BODY).setStyle(getBodyStyle());
var body = new HtmlTree(TagName.BODY).setStyle(getBodyStyle());
this.winTitle = title;
// Don't print windowtitle script for overview-frame, allclasses-frame
// and package-frame
body.add(mainBodyScript.asContent());
Content noScript = HtmlTree.NOSCRIPT(HtmlTree.DIV(contents.noScriptMessage));
var noScript = HtmlTree.NOSCRIPT(HtmlTree.DIV(contents.noScriptMessage));
body.add(noScript);
return body;
}
@ -2327,7 +2321,7 @@ public class HtmlDocletWriter {
public void addPreviewSummary(Element forWhat, Content target) {
if (utils.isPreviewAPI(forWhat)) {
Content div = HtmlTree.DIV(HtmlStyle.block);
var div = HtmlTree.DIV(HtmlStyle.block);
div.add(HtmlTree.SPAN(HtmlStyle.previewLabel, contents.previewPhrase));
target.add(div);
}
@ -2336,7 +2330,7 @@ public class HtmlDocletWriter {
public void addPreviewInfo(Element forWhat, Content target) {
if (utils.isPreviewAPI(forWhat)) {
//in Java platform:
HtmlTree previewDiv = HtmlTree.DIV(HtmlStyle.previewBlock);
var previewDiv = HtmlTree.DIV(HtmlStyle.previewBlock);
previewDiv.setId(htmlIds.forPreviewSection(forWhat));
String name = (switch (forWhat.getKind()) {
case PACKAGE, MODULE ->
@ -2345,7 +2339,7 @@ public class HtmlDocletWriter {
((TypeElement) forWhat.getEnclosingElement()).getSimpleName();
default -> forWhat.getSimpleName();
}).toString();
Content nameCode = HtmlTree.CODE(Text.of(name));
var nameCode = HtmlTree.CODE(Text.of(name));
boolean isReflectivePreview = utils.isReflectivePreviewAPI(forWhat);
String leadingNoteKey =
!isReflectivePreview ? "doclet.PreviewPlatformLeadingNote"
@ -2366,13 +2360,13 @@ public class HtmlDocletWriter {
List<Content> previewNotes = getPreviewNotes((TypeElement) forWhat);
if (!previewNotes.isEmpty()) {
Name name = forWhat.getSimpleName();
Content nameCode = HtmlTree.CODE(Text.of(name));
HtmlTree previewDiv = HtmlTree.DIV(HtmlStyle.previewBlock);
var nameCode = HtmlTree.CODE(Text.of(name));
var previewDiv = HtmlTree.DIV(HtmlStyle.previewBlock);
previewDiv.setId(htmlIds.forPreviewSection(forWhat));
Content leadingNote = contents.getContent("doclet.PreviewLeadingNote", nameCode);
previewDiv.add(HtmlTree.SPAN(HtmlStyle.previewLabel,
leadingNote));
HtmlTree ul = HtmlTree.UL(HtmlStyle.previewComment);
var ul = HtmlTree.UL(HtmlStyle.previewComment);
for (Content note : previewNotes) {
ul.add(HtmlTree.LI(note));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022, 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
@ -64,86 +64,67 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
return utils.serializableFields(te);
}
/**
* Return the header for serializable fields section.
*
* @return a content tree for the header
*/
@Override
public Content getSerializableFieldsHeader() {
return HtmlTree.UL(HtmlStyle.blockList);
}
/**
* Return the header for serializable fields content section.
*
* @param isLastContent true if the content being documented is the last content.
* @return a content tree for the header
*/
@Override
public Content getFieldsContentHeader(boolean isLastContent) {
return new HtmlTree(TagName.LI).setStyle(HtmlStyle.blockList);
}
/**
* Add serializable fields.
*
* @param heading the heading for the section
* @param serializableFieldsTree the tree to be added to the serializable fields
* content tree
* @return a content tree for the serializable fields content
*/
@Override
public Content getSerializableFields(String heading, Content serializableFieldsTree) {
HtmlTree section = HtmlTree.SECTION(HtmlStyle.detail);
if (serializableFieldsTree.isValid()) {
public Content getSerializableFields(String heading, Content source) {
var section = HtmlTree.SECTION(HtmlStyle.detail);
if (source.isValid()) {
Content headingContent = Text.of(heading);
Content serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent);
var serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent);
section.add(serialHeading);
section.add(serializableFieldsTree);
section.add(source);
}
return HtmlTree.LI(section);
}
@Override
public void addMemberHeader(TypeMirror fieldType, String fieldName, Content contentTree) {
public void addMemberHeader(TypeMirror fieldType, String fieldName, Content content) {
Content nameContent = Text.of(fieldName);
Content heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, nameContent);
contentTree.add(heading);
Content pre = new HtmlTree(TagName.PRE);
var heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, nameContent);
content.add(heading);
var pre = new HtmlTree(TagName.PRE);
Content fieldContent = writer.getLink(new HtmlLinkInfo(
configuration, HtmlLinkInfo.Kind.SERIAL_MEMBER, fieldType));
pre.add(fieldContent);
pre.add(" ");
pre.add(fieldName);
contentTree.add(pre);
content.add(pre);
}
/**
* Add the deprecated information for this member.
*
* @param field the field to document.
* @param contentTree the tree to which the deprecated info will be added
* @param content the content to which the deprecated info will be added
*/
@Override
public void addMemberDeprecatedInfo(VariableElement field, Content contentTree) {
addDeprecatedInfo(field, contentTree);
public void addMemberDeprecatedInfo(VariableElement field, Content content) {
addDeprecatedInfo(field, content);
}
/**
* Add the description text for this member.
*
* @param field the field to document.
* @param contentTree the tree to which the deprecated info will be added
* @param content the content to which the deprecated info will be added
*/
@Override
public void addMemberDescription(VariableElement field, Content contentTree) {
public void addMemberDescription(VariableElement field, Content content) {
if (!utils.getFullBody(field).isEmpty()) {
writer.addInlineComment(field, contentTree);
writer.addInlineComment(field, content);
}
List<? extends SerialTree> tags = utils.getSerialTrees(field);
if (!tags.isEmpty() && !tags.get(0).getDescription().isEmpty()) {
writer.addInlineComment(field, tags.get(0), contentTree);
writer.addInlineComment(field, tags.get(0), content);
}
}
@ -151,16 +132,16 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
* Add the description text for this member represented by the tag.
*
* @param serialFieldTag the field to document (represented by tag)
* @param contentTree the tree to which the deprecated info will be added
* @param content the content to which the deprecated info will be added
*/
@Override
public void addMemberDescription(VariableElement field, DocTree serialFieldTag, Content contentTree) {
public void addMemberDescription(VariableElement field, DocTree serialFieldTag, Content content) {
CommentHelper ch = utils.getCommentHelper(field);
List<? extends DocTree> description = ch.getDescription(serialFieldTag);
if (!description.isEmpty()) {
Content serialFieldContent = new RawHtml(ch.getText(description));
Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent);
contentTree.add(div);
var div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent);
content.add(div);
}
}
@ -168,15 +149,15 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
* Add the tag information for this member.
*
* @param field the field to document.
* @param contentTree the tree to which the member tags info will be added
* @param content the content to which the member tags info will be added
*/
@Override
public void addMemberTags(VariableElement field, Content contentTree) {
public void addMemberTags(VariableElement field, Content content) {
Content tagContent = writer.getBlockTagOutput(field);
if (!tagContent.isEmpty()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(tagContent);
contentTree.add(dl);
content.add(dl);
}
}

View File

@ -53,22 +53,11 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
super(writer, typeElement);
}
/**
* Return the header for serializable methods section.
*
* @return a content tree for the header
*/
@Override
public Content getSerializableMethodsHeader() {
return HtmlTree.UL(HtmlStyle.blockList);
}
/**
* Return the header for serializable methods content section.
*
* @param isLastContent true if the content being documented is the last content.
* @return a content tree for the header
*/
@Override
public Content getMethodsContentHeader(boolean isLastContent) {
return new HtmlTree(TagName.LI);
@ -78,16 +67,16 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
* Add serializable methods.
*
* @param heading the heading for the section
* @param serializableMethodContent the tree to be added to the serializable methods
* content tree
* @return a content tree for the serializable methods content
* @param source the content to be added to the serializable methods
* content
* @return a content for the serializable methods content
*/
@Override
public Content getSerializableMethods(String heading, Content serializableMethodContent) {
public Content getSerializableMethods(String heading, Content source) {
Content headingContent = Text.of(heading);
Content serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent);
Content section = HtmlTree.SECTION(HtmlStyle.detail, serialHeading);
section.add(serializableMethodContent);
var serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent);
var section = HtmlTree.SECTION(HtmlStyle.detail, serialHeading);
section.add(source);
return HtmlTree.LI(section);
}
@ -106,51 +95,51 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
* Add the member header.
*
* @param member the method document to be listed
* @param methodsContentTree the content tree to which the member header will be added
* @param methodsContent the content to which the member header will be added
*/
@Override
public void addMemberHeader(ExecutableElement member, Content methodsContentTree) {
public void addMemberHeader(ExecutableElement member, Content methodsContent) {
Content memberContent = Text.of(name(member));
Content heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, memberContent);
methodsContentTree.add(heading);
methodsContentTree.add(getSignature(member));
var heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, memberContent);
methodsContent.add(heading);
methodsContent.add(getSignature(member));
}
/**
* Add the deprecated information for this member.
*
* @param member the method to document.
* @param methodsContentTree the tree to which the deprecated info will be added
* @param methodsContent the content to which the deprecated info will be added
*/
@Override
public void addDeprecatedMemberInfo(ExecutableElement member, Content methodsContentTree) {
addDeprecatedInfo(member, methodsContentTree);
public void addDeprecatedMemberInfo(ExecutableElement member, Content methodsContent) {
addDeprecatedInfo(member, methodsContent);
}
/**
* Add the description text for this member.
*
* @param member the method to document.
* @param methodsContentTree the tree to which the deprecated info will be added
* @param methodsContent the content to which the deprecated info will be added
*/
@Override
public void addMemberDescription(ExecutableElement member, Content methodsContentTree) {
addComment(member, methodsContentTree);
public void addMemberDescription(ExecutableElement member, Content methodsContent) {
addComment(member, methodsContent);
}
/**
* Add the tag information for this member.
*
* @param member the method to document.
* @param methodsContentTree the tree to which the member tags info will be added
* @param methodsContent the content to which the member tags info will be added
*/
@Override
public void addMemberTags(ExecutableElement member, Content methodsContentTree) {
public void addMemberTags(ExecutableElement member, Content methodsContent) {
TagletManager tagletManager = configuration.tagletManager;
Content tagContent = writer.getBlockTagOutput(member, tagletManager.getSerializedFormTaglets());
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
var dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(tagContent);
methodsContentTree.add(dl);
methodsContent.add(dl);
if (name(member).equals("writeExternal")
&& utils.getSerialDataTrees(member).isEmpty()) {
serialWarning(member, "doclet.MissingSerialDataTag",

View File

@ -93,7 +93,7 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
Script script = new Script("window.location.replace(")
.appendStringLiteral(targetPath, '\'')
.append(")");
HtmlTree metaRefresh = new HtmlTree(TagName.META)
var metaRefresh = new HtmlTree(TagName.META)
.put(HtmlAttr.HTTP_EQUIV, "Refresh")
.put(HtmlAttr.CONTENT, "0;" + targetPath);
head.addContent(script.asContent(), HtmlTree.NOSCRIPT(metaRefresh));
@ -104,8 +104,8 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
bodyContent.add(HtmlTree.P(HtmlTree.A(targetPath, Text.of(targetPath))));
Content body = new HtmlTree(TagName.BODY).setStyle(HtmlStyle.indexRedirectPage);
HtmlTree main = HtmlTree.MAIN(bodyContent);
var body = new HtmlTree(TagName.BODY).setStyle(HtmlStyle.indexRedirectPage);
var main = HtmlTree.MAIN(bodyContent);
body.add(main);
HtmlDocument htmlDocument = new HtmlDocument(

View File

@ -144,31 +144,31 @@ public class IndexWriter extends HtmlDocletWriter {
/**
* Adds a set of items to the page.
*
* @param ch the first character of the names of the items
* @param items the items
* @param contentTree the tree to which to add the items
* @param ch the first character of the names of the items
* @param items the items
* @param content the content to which to add the items
*/
protected void addContents(char ch, SortedSet<IndexItem> items, Content contentTree) {
addHeading(ch, contentTree);
protected void addContents(char ch, SortedSet<IndexItem> items, Content content) {
addHeading(ch, content);
HtmlTree dl = HtmlTree.DL(HtmlStyle.index);
var dl = HtmlTree.DL(HtmlStyle.index);
for (IndexItem item : items) {
addDescription(item, dl);
}
contentTree.add(dl);
content.add(dl);
}
/**
* Adds a heading containing the first character for a set of items.
*
* @param ch the first character of the names of the items
* @param contentTree the tree to which to add the items
* @param ch the first character of the names of the items
* @param content the content to which to add the items
*/
protected void addHeading(char ch, Content contentTree) {
protected void addHeading(char ch, Content content) {
Content headContent = Text.of(String.valueOf(ch));
HtmlTree heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, HtmlStyle.title, headContent)
var heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, HtmlStyle.title, headContent)
.setId(HtmlIds.forIndexChar(ch));
contentTree.add(heading);
content.add(heading);
}
/**
@ -189,9 +189,9 @@ public class IndexWriter extends HtmlDocletWriter {
* Add one line summary comment for the item.
*
* @param item the item to be documented
* @param dlTree the content tree to which the description will be added
* @param target the content to which the description will be added
*/
protected void addElementDescription(IndexItem item, Content dlTree) {
protected void addElementDescription(IndexItem item, Content target) {
Content dt;
Element element = item.getElement();
String label = item.getLabel();
@ -234,24 +234,24 @@ public class IndexWriter extends HtmlDocletWriter {
default:
throw new Error();
}
dlTree.add(dt);
Content dd = new HtmlTree(TagName.DD);
target.add(dt);
var dd = new HtmlTree(TagName.DD);
if (element.getKind() == ElementKind.MODULE || element.getKind() == ElementKind.PACKAGE) {
addSummaryComment(element, dd);
} else {
addComment(element, dd);
}
dlTree.add(dd);
target.add(dd);
}
/**
* Adds information for the given type element.
*
* @param te the element
* @param contentTree the content tree to which the class info will be added
* @param te the element
* @param content the content to which the class info will be added
*/
protected void addClassInfo(TypeElement te, Content contentTree) {
contentTree.add(contents.getContent("doclet.in",
protected void addClassInfo(TypeElement te, Content content) {
content.add(contents.getContent("doclet.in",
utils.getTypeElementKindName(te, false),
getPackageLink(utils.containingPackage(te),
getLocalizedPackageName(utils.containingPackage(te)))
@ -262,23 +262,23 @@ public class IndexWriter extends HtmlDocletWriter {
* Adds a description for an item found in a documentation comment.
*
* @param item the item
* @param dlTree the list to which to add the description
* @param target the list to which to add the description
*/
protected void addTagDescription(IndexItem item, Content dlTree) {
protected void addTagDescription(IndexItem item, Content target) {
String itemPath = pathToRoot.isEmpty() ? "" : pathToRoot.getPath() + "/";
itemPath += item.getUrl();
HtmlTree labelLink = HtmlTree.A(itemPath, Text.of(item.getLabel()));
Content dt = HtmlTree.DT(labelLink.setStyle(HtmlStyle.searchTagLink));
var labelLink = HtmlTree.A(itemPath, Text.of(item.getLabel()));
var dt = HtmlTree.DT(labelLink.setStyle(HtmlStyle.searchTagLink));
dt.add(" - ");
dt.add(contents.getContent("doclet.Search_tag_in", item.getHolder()));
dlTree.add(dt);
Content dd = new HtmlTree(TagName.DD);
target.add(dt);
var dd = new HtmlTree(TagName.DD);
if (item.getDescription().isEmpty()) {
dd.add(Entity.NO_BREAK_SPACE);
} else {
dd.add(item.getDescription());
}
dlTree.add(dd);
target.add(dd);
}
/**
@ -288,39 +288,39 @@ public class IndexWriter extends HtmlDocletWriter {
* the start and then print the normal comment.
*
* @param element the element
* @param contentTree the content tree to which the comment will be added
* @param content the content to which the comment will be added
*/
protected void addComment(Element element, Content contentTree) {
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element));
HtmlTree div = HtmlTree.DIV(HtmlStyle.deprecationBlock);
protected void addComment(Element element, Content content) {
var span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element));
var div = HtmlTree.DIV(HtmlStyle.deprecationBlock);
if (utils.isDeprecated(element)) {
div.add(span);
List<? extends DeprecatedTree> tags = utils.getDeprecatedTrees(element);
if (!tags.isEmpty())
addInlineDeprecatedComment(element, tags.get(0), div);
contentTree.add(div);
content.add(div);
} else {
TypeElement encl = utils.getEnclosingTypeElement(element);
while (encl != null) {
if (utils.isDeprecated(encl)) {
div.add(span);
contentTree.add(div);
content.add(div);
break;
}
encl = utils.getEnclosingTypeElement(encl);
}
addSummaryComment(element, contentTree);
addSummaryComment(element, content);
}
}
/**
* Adds a description for a member element.
*
* @param member the element
* @param enclosing the enclosing type element
* @param contentTree the content tree to which the member description will be added
* @param member the element
* @param enclosing the enclosing type element
* @param content the content to which the member description will be added
*/
protected void addMemberDesc(Element member, TypeElement enclosing, Content contentTree) {
protected void addMemberDesc(Element member, TypeElement enclosing, Content content) {
String kindName = utils.getTypeElementKindName(enclosing, true);
String resource = switch (member.getKind()) {
case ENUM_CONSTANT ->
@ -336,18 +336,18 @@ public class IndexWriter extends HtmlDocletWriter {
"doclet.Record_component_in";
default -> throw new IllegalArgumentException(member.getKind().toString());
};
contentTree.add(contents.getContent(resource, kindName)).add(" ");
content.add(contents.getContent(resource, kindName)).add(" ");
addPreQualifiedClassLink(HtmlLinkInfo.Kind.INDEX, enclosing,
null, contentTree);
null, content);
}
/**
* Add links for all the index files, based on the first character of the names of the items.
*
* @param allFirstCharacters the list of all first characters to be linked
* @param contentTree the content tree to which the links for indexes will be added
* @param content the content to which the links for indexes will be added
*/
protected void addLinksForIndexes(List<Character> allFirstCharacters, Content contentTree) {
protected void addLinksForIndexes(List<Character> allFirstCharacters, Content content) {
ListIterator<Character> iter = allFirstCharacters.listIterator();
while (iter.hasNext()) {
char ch = iter.next();
@ -355,11 +355,11 @@ public class IndexWriter extends HtmlDocletWriter {
Content link = splitIndex
? links.createLink(DocPaths.indexN(iter.nextIndex()), label)
: links.createLink(HtmlIds.forIndexChar(ch), label);
contentTree.add(link);
contentTree.add(Entity.NO_BREAK_SPACE);
content.add(link);
content.add(Entity.NO_BREAK_SPACE);
}
contentTree.add(new HtmlTree(TagName.BR));
content.add(new HtmlTree(TagName.BR));
List<Content> pageLinks = Stream.of(IndexItem.Category.values())
.flatMap(c -> mainIndex.getItems(c).stream())
.filter(i -> !(i.isElementItem() || i.isTagItem()))
@ -367,7 +367,7 @@ public class IndexWriter extends HtmlDocletWriter {
.map(i -> links.createLink(pathToRoot.resolve(i.getUrl()),
contents.getNonBreakString(i.getLabel())))
.toList();
contentTree.add(contents.join(getVerticalSeparator(), pageLinks));
content.add(contents.join(getVerticalSeparator(), pageLinks));
}
private Content getVerticalSeparator() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -76,11 +76,11 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_METHOD_SUMMARY);
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;
public Content getMemberSummaryHeader(TypeElement typeElement, Content target) {
target.add(MarkerComments.START_OF_METHOD_SUMMARY);
Content memberContent = new ContentBuilder();
writer.addSummaryHeader(this, memberContent);
return memberContent;
}
@Override
@ -90,35 +90,29 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public Content getMethodDetailsTreeHeader(Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_METHOD_DETAILS);
Content methodDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
public Content getMethodDetailsHeader(Content content) {
content.add(MarkerComments.START_OF_METHOD_DETAILS);
Content methodDetailsContent = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.methodDetailLabel);
methodDetailsTree.add(heading);
return methodDetailsTree;
methodDetailsContent.add(heading);
return methodDetailsContent;
}
@Override
public Content getMethodDocTreeHeader(ExecutableElement method) {
Content methodDocTree = new ContentBuilder();
HtmlTree heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
public Content getMethodHeader(ExecutableElement method) {
Content content = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
Text.of(name(method)));
HtmlId erasureAnchor;
if ((erasureAnchor = htmlIds.forErasure(method)) != null) {
heading.setId(erasureAnchor);
}
methodDocTree.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, methodDocTree)
content.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, content)
.setId(htmlIds.forMember(method));
}
/**
* Get the signature for the given method.
*
* @param method the method being documented.
* @return a content object for the signature
*/
@Override
public Content getSignature(ExecutableElement method) {
return new Signatures.MemberSignature(method, this)
@ -131,23 +125,23 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public void addDeprecated(ExecutableElement method, Content methodDocTree) {
addDeprecatedInfo(method, methodDocTree);
public void addDeprecated(ExecutableElement method, Content methodContent) {
addDeprecatedInfo(method, methodContent);
}
@Override
public void addPreview(ExecutableElement method, Content methodDocTree) {
addPreviewInfo(method, methodDocTree);
public void addPreview(ExecutableElement method, Content content) {
addPreviewInfo(method, content);
}
@Override
public void addComments(TypeMirror holderType, ExecutableElement method, Content methodDocTree) {
public void addComments(TypeMirror holderType, ExecutableElement method, Content methodContent) {
TypeElement holder = utils.asTypeElement(holderType);
if (!utils.getFullBody(method).isEmpty()) {
if (holder.equals(typeElement) ||
!(utils.isPublic(holder) ||
utils.isLinkable(holder))) {
writer.addInlineComment(method, methodDocTree);
writer.addInlineComment(method, methodContent);
} else {
if (!utils.hasHiddenTag(holder) && !utils.hasHiddenTag(method)) {
Content link =
@ -156,37 +150,37 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
utils.isIncluded(holder)
? utils.getSimpleName(holder)
: utils.getFullyQualifiedName(holder));
Content codeLink = HtmlTree.CODE(link);
Content descriptionFromTypeLabel = HtmlTree.SPAN(HtmlStyle.descriptionFromTypeLabel,
var codeLink = HtmlTree.CODE(link);
var descriptionFromTypeLabel = HtmlTree.SPAN(HtmlStyle.descriptionFromTypeLabel,
utils.isClass(holder)
? contents.descriptionFromClassLabel
: contents.descriptionFromInterfaceLabel);
descriptionFromTypeLabel.add(Entity.NO_BREAK_SPACE);
descriptionFromTypeLabel.add(codeLink);
methodDocTree.add(HtmlTree.DIV(HtmlStyle.block, descriptionFromTypeLabel));
methodContent.add(HtmlTree.DIV(HtmlStyle.block, descriptionFromTypeLabel));
}
writer.addInlineComment(method, methodDocTree);
writer.addInlineComment(method, methodContent);
}
}
}
@Override
public void addTags(ExecutableElement method, Content methodDocTree) {
writer.addTagsInfo(method, methodDocTree);
public void addTags(ExecutableElement method, Content methodContent) {
writer.addTagsInfo(method, methodContent);
}
@Override
public Content getMethodDetails(Content methodDetailsTreeHeader, Content methodDetailsTree) {
Content methodDetails = new ContentBuilder(methodDetailsTreeHeader, methodDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.methodDetails, methodDetails)
public Content getMethodDetails(Content methodDetailsHeader, Content methodDetails) {
Content c = new ContentBuilder(methodDetailsHeader, methodDetails);
return getMember(HtmlTree.SECTION(HtmlStyle.methodDetails, c)
.setId(HtmlIds.METHOD_DETAIL));
}
@Override
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
public void addSummaryLabel(Content content) {
var label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
contents.methodSummary);
memberTree.add(label);
content.add(label);
}
@Override
@ -213,7 +207,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
public void addInheritedSummaryLabel(TypeElement typeElement, Content content) {
Content classLink = writer.getPreQualifiedClassLink(
HtmlLinkInfo.Kind.MEMBER, typeElement);
Content label;
@ -226,18 +220,18 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
? resources.getText("doclet.Methods_Inherited_From_Class")
: resources.getText("doclet.Methods_Inherited_From_Interface"));
}
HtmlTree labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING,
var labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING,
label);
labelHeading.setId(htmlIds.forInheritedMethods(typeElement));
labelHeading.add(Entity.NO_BREAK_SPACE);
labelHeading.add(classLink);
inheritedTree.add(labelHeading);
content.add(labelHeading);
}
@Override
protected void addSummaryType(Element member, Content tdSummaryType) {
protected void addSummaryType(Element member, Content content) {
ExecutableElement meth = (ExecutableElement)member;
addModifierAndType(meth, utils.getReturnType(typeElement, meth), tdSummaryType);
addModifiersAndType(meth, utils.getReturnType(typeElement, meth), content);
}
/**
@ -286,13 +280,13 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
dl.add(HtmlTree.DT(label));
Content overriddenTypeLink =
writer.getLink(new HtmlLinkInfo(writer.configuration, context, overriddenType));
Content codeOverriddenTypeLink = HtmlTree.CODE(overriddenTypeLink);
var codeOverriddenTypeLink = HtmlTree.CODE(overriddenTypeLink);
Content methlink = writer.getLink(
new HtmlLinkInfo(writer.configuration, HtmlLinkInfo.Kind.MEMBER, holder)
.where(writer.htmlIds.forMember(method).name())
.label(method.getSimpleName()));
Content codeMethLink = HtmlTree.CODE(methlink);
Content dd = HtmlTree.DD(codeMethLink);
var codeMethLink = HtmlTree.CODE(methlink);
var dd = HtmlTree.DD(codeMethLink);
dd.add(Entity.NO_BREAK_SPACE);
dd.add(contents.inClass);
dd.add(Entity.NO_BREAK_SPACE);
@ -326,13 +320,13 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
intfac = utils.getDeclaredType(utils.getEnclosingTypeElement(method), intfac);
Content intfaclink = writer.getLink(new HtmlLinkInfo(
writer.configuration, HtmlLinkInfo.Kind.METHOD_SPECIFIED_BY, intfac));
Content codeIntfacLink = HtmlTree.CODE(intfaclink);
var codeIntfacLink = HtmlTree.CODE(intfaclink);
dl.add(HtmlTree.DT(contents.specifiedByLabel));
Content methlink = writer.getDocLink(
HtmlLinkInfo.Kind.MEMBER, implementedMeth,
implementedMeth.getSimpleName());
Content codeMethLink = HtmlTree.CODE(methlink);
Content dd = HtmlTree.DD(codeMethLink);
var codeMethLink = HtmlTree.CODE(methlink);
var dd = HtmlTree.DD(codeMethLink);
dd.add(Entity.NO_BREAK_SPACE);
dd.add(contents.inInterface);
dd.add(Entity.NO_BREAK_SPACE);
@ -345,7 +339,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
* Get the return type for the given method.
*
* @param method the method being documented.
* @return content containing the return type
* @return the return type
*/
protected Content getReturnType(ExecutableElement method) {
TypeMirror type = utils.getReturnType(typeElement, method);
@ -356,7 +350,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
public Content getMemberHeader(){
return writer.getMemberHeader();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2022, 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
@ -80,10 +80,10 @@ public class ModuleIndexWriter extends AbstractOverviewIndexWriter {
/**
* Adds the list of modules.
*
* @param main the documentation tree to which the modules list will be added
* @param target the content to which the modules list will be added
*/
@Override
protected void addIndex(Content main) {
protected void addIndex(Content target) {
Map<String, SortedSet<ModuleElement>> groupModuleMap
= configuration.group.groupModules(modules);
@ -115,7 +115,7 @@ public class ModuleIndexWriter extends AbstractOverviewIndexWriter {
}
}
main.add(table);
target.add(table);
if (table.needsScript()) {
mainBodyScript.append(table.getScript());

View File

@ -171,25 +171,20 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
computeModulesData();
}
/**
* Get the module header.
*
* @param heading the heading for the section
*/
@Override
public Content getModuleHeader(String heading) {
HtmlTree bodyTree = getBody(getWindowTitle(mdle.getQualifiedName().toString()));
HtmlTree div = HtmlTree.DIV(HtmlStyle.header);
HtmlTree body = getBody(getWindowTitle(mdle.getQualifiedName().toString()));
var div = HtmlTree.DIV(HtmlStyle.header);
Content moduleHead = new ContentBuilder();
moduleHead.add(mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL)
? contents.openModuleLabel : contents.moduleLabel);
moduleHead.add(" ").add(heading);
Content tHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var tHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, moduleHead);
div.add(tHeading);
bodyContents.setHeader(getHeader(PageMode.MODULE, mdle))
.addMainContent(div);
return bodyTree;
return body;
}
@Override
@ -207,30 +202,19 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
));
}
/**
* Get the content header.
*/
@Override
public Content getContentHeader() {
return new ContentBuilder();
}
/**
* Get the summary section header.
*/
@Override
public Content getSummariesList() {
return HtmlTree.UL(HtmlStyle.summaryList);
}
/**
* Get the summary tree.
*
* @param summaryContentTree the content tree to be added to the summary tree.
*/
@Override
public Content getSummaryTree(Content summaryContentTree) {
return HtmlTree.SECTION(HtmlStyle.summary, summaryContentTree);
public Content getSummary(Content source) {
return HtmlTree.SECTION(HtmlStyle.summary, source);
}
/**
@ -433,12 +417,12 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
*
* @param startMarker the marker comment
* @param heading the heading for the section
* @param htmltree the content tree to which the information is added
* @param target the content to which the information is added
*/
public void addSummaryHeader(Content startMarker, Content heading,
Content htmltree) {
htmltree.add(startMarker);
htmltree.add(HtmlTree.HEADING(Headings.ModuleDeclaration.SUMMARY_HEADING, heading));
Content target) {
target.add(startMarker);
target.add(HtmlTree.HEADING(Headings.ModuleDeclaration.SUMMARY_HEADING, heading));
}
/**
@ -475,7 +459,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
TableHeader requiresTableHeader =
new TableHeader(contents.modifierLabel, contents.moduleLabel,
contents.descriptionLabel);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.modulesSummary)
var section = HtmlTree.SECTION(HtmlStyle.modulesSummary)
.setId(HtmlIds.MODULES);
addSummaryHeader(MarkerComments.START_OF_MODULES_SUMMARY, contents.navModules, section);
if (display(requires)) {
@ -517,7 +501,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
public void addPackagesSummary(Content summariesList) {
if (display(packages)
|| display(indirectPackages) || display(indirectOpenPackages)) {
HtmlTree section = HtmlTree.SECTION(HtmlStyle.packagesSummary)
var section = HtmlTree.SECTION(HtmlStyle.packagesSummary)
.setId(HtmlIds.PACKAGES);
addSummaryHeader(MarkerComments.START_OF_PACKAGES_SUMMARY, contents.navPackages, section);
if (display(packages)) {
@ -690,7 +674,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
boolean haveProvides = displayServices(provides.keySet(), providesTrees);
if (haveProvides || haveUses) {
HtmlTree section = HtmlTree.SECTION(HtmlStyle.servicesSummary)
var section = HtmlTree.SECTION(HtmlStyle.servicesSummary)
.setId(HtmlIds.SERVICES);
addSummaryHeader(MarkerComments.START_OF_SERVICES_SUMMARY, contents.navServices, section);
TableHeader usesProvidesTableHeader =
@ -773,7 +757,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
desc.add(new HtmlTree(TagName.BR));
desc.add("(");
HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
var implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
desc.add(implSpan);
desc.add(Entity.NO_BREAK_SPACE);
String sep = "";
@ -791,14 +775,14 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
/**
* Add the module deprecation information to the documentation tree.
*
* @param div the content tree to which the deprecation information will be added
* @param div the content to which the deprecation information will be added
*/
public void addDeprecationInfo(Content div) {
List<? extends DeprecatedTree> deprs = utils.getDeprecatedTrees(mdle);
if (utils.isDeprecated(mdle)) {
CommentHelper ch = utils.getCommentHelper(mdle);
HtmlTree deprDiv = HtmlTree.DIV(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
var deprDiv = HtmlTree.DIV(HtmlStyle.deprecationBlock);
var deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
deprDiv.add(deprPhrase);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(deprs.get(0));
@ -811,28 +795,28 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
}
@Override
public void addModuleDescription(Content moduleContentTree) {
addPreviewInfo(mdle, moduleContentTree);
public void addModuleDescription(Content moduleContent) {
addPreviewInfo(mdle, moduleContent);
if (!utils.getFullBody(mdle).isEmpty()) {
HtmlTree tree = HtmlTree.SECTION(HtmlStyle.moduleDescription)
var tree = HtmlTree.SECTION(HtmlStyle.moduleDescription)
.setId(HtmlIds.MODULE_DESCRIPTION);
addDeprecationInfo(tree);
tree.add(MarkerComments.START_OF_MODULE_DESCRIPTION);
addInlineComment(mdle, tree);
addTagsInfo(mdle, tree);
moduleContentTree.add(tree);
moduleContent.add(tree);
}
}
@Override
public void addModuleSignature(Content moduleContentTree) {
moduleContentTree.add(new HtmlTree(TagName.HR));
moduleContentTree.add(Signatures.getModuleSignature(mdle, this));
public void addModuleSignature(Content moduleContent) {
moduleContent.add(new HtmlTree(TagName.HR));
moduleContent.add(Signatures.getModuleSignature(mdle, this));
}
@Override
public void addModuleContent(Content moduleContentTree) {
bodyContents.addMainContent(moduleContentTree);
public void addModuleContent(Content source) {
bodyContents.addMainContent(source);
}
@Override
@ -841,23 +825,23 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
}
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
contentTree.add(bodyContents);
public void printDocument(Content content) throws DocFileIOException {
content.add(bodyContents);
printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
getDescription("declaration", mdle), getLocalStylesheets(mdle), contentTree);
getDescription("declaration", mdle), getLocalStylesheets(mdle), content);
}
/**
* Add the module package deprecation information to the documentation tree.
*
* @param li the content tree to which the deprecation information will be added
* @param li the content to which the deprecation information will be added
* @param pkg the PackageDoc that is added
*/
public void addPackageDeprecationInfo(Content li, PackageElement pkg) {
if (utils.isDeprecated(pkg)) {
List<? extends DeprecatedTree> deprs = utils.getDeprecatedTrees(pkg);
HtmlTree deprDiv = HtmlTree.DIV(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
var deprDiv = HtmlTree.DIV(HtmlStyle.deprecationBlock);
var deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
deprDiv.add(deprPhrase);
if (!deprs.isEmpty()) {
CommentHelper ch = utils.getCommentHelper(pkg);

View File

@ -162,154 +162,154 @@ public class Navigation {
/**
* Adds the links for the main navigation.
*
* @param tree the content tree to which the main navigation will added
* @param target the content to which the main navigation will added
*/
private void addMainNavLinks(Content tree) {
private void addMainNavLinks(Content target) {
switch (documentedPage) {
case OVERVIEW:
addActivePageLink(tree, contents.overviewLabel, options.createOverview());
addModuleLink(tree);
addPackageLink(tree);
addPageLabel(tree, contents.classLabel, true);
addPageLabel(tree, contents.useLabel, options.classUse());
addTreeLink(tree);
addPreviewLink(tree);
addNewLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
addActivePageLink(target, contents.overviewLabel, options.createOverview());
addModuleLink(target);
addPackageLink(target);
addPageLabel(target, contents.classLabel, true);
addPageLabel(target, contents.useLabel, options.classUse());
addTreeLink(target);
addPreviewLink(target);
addNewLink(target);
addDeprecatedLink(target);
addIndexLink(target);
addHelpLink(target);
break;
case MODULE:
addOverviewLink(tree);
addActivePageLink(tree, contents.moduleLabel, configuration.showModules);
addPackageLink(tree);
addPageLabel(tree, contents.classLabel, true);
addPageLabel(tree, contents.useLabel, options.classUse());
addTreeLink(tree);
addPreviewLink(tree);
addNewLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
addOverviewLink(target);
addActivePageLink(target, contents.moduleLabel, configuration.showModules);
addPackageLink(target);
addPageLabel(target, contents.classLabel, true);
addPageLabel(target, contents.useLabel, options.classUse());
addTreeLink(target);
addPreviewLink(target);
addNewLink(target);
addDeprecatedLink(target);
addIndexLink(target);
addHelpLink(target);
break;
case PACKAGE:
addOverviewLink(tree);
addModuleOfElementLink(tree);
addActivePageLink(tree, contents.packageLabel, true);
addPageLabel(tree, contents.classLabel, true);
addOverviewLink(target);
addModuleOfElementLink(target);
addActivePageLink(target, contents.packageLabel, true);
addPageLabel(target, contents.classLabel, true);
if (options.classUse()) {
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_USE,
addItemToList(target, links.createLink(DocPaths.PACKAGE_USE,
contents.useLabel, ""));
}
if (options.createTree()) {
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE,
addItemToList(target, links.createLink(DocPaths.PACKAGE_TREE,
contents.treeLabel, ""));
}
addPreviewLink(tree);
addNewLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
addPreviewLink(target);
addNewLink(target);
addDeprecatedLink(target);
addIndexLink(target);
addHelpLink(target);
break;
case CLASS:
addOverviewLink(tree);
addModuleOfElementLink(tree);
addPackageSummaryLink(tree);
addActivePageLink(tree, contents.classLabel, true);
addOverviewLink(target);
addModuleOfElementLink(target);
addPackageSummaryLink(target);
addActivePageLink(target, contents.classLabel, true);
if (options.classUse()) {
addContentToTree(tree, links.createLink(DocPaths.CLASS_USE.resolve(path.basename()),
addItemToList(target, links.createLink(DocPaths.CLASS_USE.resolve(path.basename()),
contents.useLabel));
}
if (options.createTree()) {
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE,
addItemToList(target, links.createLink(DocPaths.PACKAGE_TREE,
contents.treeLabel, ""));
}
addPreviewLink(tree);
addNewLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
addPreviewLink(target);
addNewLink(target);
addDeprecatedLink(target);
addIndexLink(target);
addHelpLink(target);
break;
case USE:
addOverviewLink(tree);
addModuleOfElementLink(tree);
addOverviewLink(target);
addModuleOfElementLink(target);
if (element instanceof PackageElement) {
addPackageSummaryLink(tree);
addPageLabel(tree, contents.classLabel, true);
addPackageSummaryLink(target);
addPageLabel(target, contents.classLabel, true);
} else {
addPackageOfElementLink(tree);
addContentToTree(tree, navLinkClass);
addPackageOfElementLink(target);
addItemToList(target, navLinkClass);
}
addActivePageLink(tree, contents.useLabel, options.classUse());
addActivePageLink(target, contents.useLabel, options.classUse());
if (element instanceof PackageElement) {
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE, contents.treeLabel));
addItemToList(target, links.createLink(DocPaths.PACKAGE_TREE, contents.treeLabel));
} else {
addContentToTree(tree, configuration.utils.isEnclosingPackageIncluded((TypeElement) element)
addItemToList(target, configuration.utils.isEnclosingPackageIncluded((TypeElement) element)
? links.createLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), contents.treeLabel)
: links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), contents.treeLabel));
}
addPreviewLink(tree);
addNewLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
addPreviewLink(target);
addNewLink(target);
addDeprecatedLink(target);
addIndexLink(target);
addHelpLink(target);
break;
case TREE:
addOverviewLink(tree);
addOverviewLink(target);
if (element == null) {
addPageLabel(tree, contents.moduleLabel, configuration.showModules);
addPageLabel(tree, contents.packageLabel, true);
addPageLabel(target, contents.moduleLabel, configuration.showModules);
addPageLabel(target, contents.packageLabel, true);
} else {
addModuleOfElementLink(tree);
addPackageSummaryLink(tree);
addModuleOfElementLink(target);
addPackageSummaryLink(target);
}
addPageLabel(tree, contents.classLabel, true);
addPageLabel(tree, contents.useLabel, options.classUse());
addActivePageLink(tree, contents.treeLabel, options.createTree());
addPreviewLink(tree);
addNewLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
addPageLabel(target, contents.classLabel, true);
addPageLabel(target, contents.useLabel, options.classUse());
addActivePageLink(target, contents.treeLabel, options.createTree());
addPreviewLink(target);
addNewLink(target);
addDeprecatedLink(target);
addIndexLink(target);
addHelpLink(target);
break;
case DEPRECATED:
case INDEX:
case HELP:
case PREVIEW:
case NEW:
addOverviewLink(tree);
addModuleLink(tree);
addPackageLink(tree);
addPageLabel(tree, contents.classLabel, true);
addPageLabel(tree, contents.useLabel, options.classUse());
addTreeLink(tree);
addOverviewLink(target);
addModuleLink(target);
addPackageLink(target);
addPageLabel(target, contents.classLabel, true);
addPageLabel(target, contents.useLabel, options.classUse());
addTreeLink(target);
if (documentedPage == PageMode.PREVIEW) {
addActivePageLink(tree, contents.previewLabel,
addActivePageLink(target, contents.previewLabel,
configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.PREVIEW));
} else {
addPreviewLink(tree);
addPreviewLink(target);
}
if (documentedPage == PageMode.NEW) {
addActivePageLink(tree, contents.newLabel,
addActivePageLink(target, contents.newLabel,
configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.NEW));
} else {
addNewLink(tree);
addNewLink(target);
}
if (documentedPage == PageMode.DEPRECATED) {
addActivePageLink(tree, contents.deprecatedLabel,
addActivePageLink(target, contents.deprecatedLabel,
configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.DEPRECATED));
} else {
addDeprecatedLink(tree);
addDeprecatedLink(target);
}
if (documentedPage == PageMode.INDEX) {
addActivePageLink(tree, contents.indexLabel, options.createIndex());
addActivePageLink(target, contents.indexLabel, options.createIndex());
} else {
addIndexLink(tree);
addIndexLink(target);
}
if (documentedPage == PageMode.HELP) {
addActivePageLink(tree, contents.helpLabel, !options.noHelp());
addActivePageLink(target, contents.helpLabel, !options.noHelp());
} else {
addHelpLink(tree);
addHelpLink(target);
}
break;
case ALL_CLASSES:
@ -317,30 +317,30 @@ public class Navigation {
case CONSTANT_VALUES:
case SERIALIZED_FORM:
case SYSTEM_PROPERTIES:
addOverviewLink(tree);
addModuleLink(tree);
addPackageLink(tree);
addPageLabel(tree, contents.classLabel, true);
addPageLabel(tree, contents.useLabel, options.classUse());
addTreeLink(tree);
addPreviewLink(tree);
addNewLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
addOverviewLink(target);
addModuleLink(target);
addPackageLink(target);
addPageLabel(target, contents.classLabel, true);
addPageLabel(target, contents.useLabel, options.classUse());
addTreeLink(target);
addPreviewLink(target);
addNewLink(target);
addDeprecatedLink(target);
addIndexLink(target);
addHelpLink(target);
break;
case DOC_FILE:
addOverviewLink(tree);
addModuleOfElementLink(tree);
addContentToTree(tree, navLinkPackage);
addPageLabel(tree, contents.classLabel, true);
addPageLabel(tree, contents.useLabel, options.classUse());
addTreeLink(tree);
addPreviewLink(tree);
addNewLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
addOverviewLink(target);
addModuleOfElementLink(target);
addItemToList(target, navLinkPackage);
addPageLabel(target, contents.classLabel, true);
addPageLabel(target, contents.useLabel, options.classUse());
addTreeLink(target);
addPreviewLink(target);
addNewLink(target);
addDeprecatedLink(target);
addIndexLink(target);
addHelpLink(target);
break;
default:
break;
@ -350,10 +350,10 @@ public class Navigation {
/**
* Adds the summary links to the sub-navigation.
*
* @param tree the content tree to which the sub-navigation will added
* @param target the content to which the sub-navigation will be added
* @param nested whether to create a flat or nested list
*/
private void addSummaryLinks(Content tree, boolean nested) {
private void addSummaryLinks(Content target, boolean nested) {
switch (documentedPage) {
case MODULE, PACKAGE, CLASS, HELP -> {
List<? extends Content> listContents = subNavLinks.getSubNavLinks()
@ -367,11 +367,11 @@ public class Navigation {
default -> Text.EMPTY;
};
if (nested) {
tree.add(HtmlTree.LI(HtmlTree.P(label))
target.add(HtmlTree.LI(HtmlTree.P(label))
.add(new HtmlTree(TagName.UL).add(listContents)));
} else {
tree.add(HtmlTree.LI(label).add(Entity.NO_BREAK_SPACE));
addListToNav(listContents, tree);
target.add(HtmlTree.LI(label).add(Entity.NO_BREAK_SPACE));
addListToNav(listContents, target);
}
}
}
@ -381,10 +381,10 @@ public class Navigation {
/**
* Adds the detail links to sub-navigation.
*
* @param tree the content tree to which the links will be added
* @param target the content to which the links will be added
* @param nested whether to create a flat or nested list
*/
private void addDetailLinks(Content tree, boolean nested) {
private void addDetailLinks(Content target, boolean nested) {
if (documentedPage == PageMode.CLASS) {
List<Content> listContents = new ArrayList<>();
VisibleMemberTable vmt = configuration.getVisibleMemberTable((TypeElement) element);
@ -394,14 +394,14 @@ public class Navigation {
}
if (!listContents.isEmpty()) {
if (nested) {
Content li = HtmlTree.LI(HtmlTree.P(contents.detailLabel));
var li = HtmlTree.LI(HtmlTree.P(contents.detailLabel));
li.add(new HtmlTree(TagName.UL).add(listContents));
tree.add(li);
target.add(li);
} else {
Content li = HtmlTree.LI(contents.detailLabel);
var li = HtmlTree.LI(contents.detailLabel);
li.add(Entity.NO_BREAK_SPACE);
tree.add(li);
addListToNav(listContents, tree);
target.add(li);
addListToNav(listContents, target);
}
}
}
@ -427,15 +427,15 @@ public class Navigation {
});
}
private void addContentToList(List<Content> listContents, Content tree) {
listContents.add(HtmlTree.LI(tree));
private void addContentToList(List<Content> listContents, Content source) {
listContents.add(HtmlTree.LI(source));
}
private void addContentToTree(Content tree, Content content) {
tree.add(HtmlTree.LI(content));
private void addItemToList(Content list, Content item) {
list.add(HtmlTree.LI(item));
}
private void addListToNav(List<? extends Content> listContents, Content tree) {
private void addListToNav(List<? extends Content> listContents, Content target) {
int count = 0;
for (Content liContent : listContents) {
if (count < listContents.size() - 1) {
@ -443,51 +443,51 @@ public class Navigation {
liContent.add("|");
liContent.add(Entity.NO_BREAK_SPACE);
}
tree.add(liContent);
target.add(liContent);
count++;
}
}
private void addActivePageLink(Content tree, Content label, boolean display) {
private void addActivePageLink(Content target, Content label, boolean display) {
if (display) {
tree.add(HtmlTree.LI(HtmlStyle.navBarCell1Rev, label));
target.add(HtmlTree.LI(HtmlStyle.navBarCell1Rev, label));
}
}
private void addPageLabel(Content tree, Content label, boolean display) {
private void addPageLabel(Content target, Content label, boolean display) {
if (display) {
tree.add(HtmlTree.LI(label));
target.add(HtmlTree.LI(label));
}
}
private void addOverviewLink(Content tree) {
private void addOverviewLink(Content target) {
if (options.createOverview()) {
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.INDEX),
target.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.INDEX),
contents.overviewLabel, "")));
}
}
private void addModuleLink(Content tree) {
private void addModuleLink(Content target) {
if (configuration.showModules) {
if (configuration.modules.size() == 1) {
ModuleElement mdle = configuration.modules.first();
boolean included = configuration.utils.isIncluded(mdle);
tree.add(HtmlTree.LI((included)
target.add(HtmlTree.LI((included)
? links.createLink(pathToRoot.resolve(configuration.docPaths.moduleSummary(mdle)), contents.moduleLabel, "")
: contents.moduleLabel));
} else if (!configuration.modules.isEmpty()) {
addPageLabel(tree, contents.moduleLabel, true);
addPageLabel(target, contents.moduleLabel, true);
}
}
}
private void addModuleOfElementLink(Content tree) {
private void addModuleOfElementLink(Content target) {
if (configuration.showModules) {
tree.add(HtmlTree.LI(navLinkModule));
target.add(HtmlTree.LI(navLinkModule));
}
}
private void addPackageLink(Content tree) {
private void addPackageLink(Content target) {
if (configuration.packages.size() == 1) {
PackageElement packageElement = configuration.packages.first();
boolean included = packageElement != null && configuration.utils.isIncluded(packageElement);
@ -500,66 +500,66 @@ public class Navigation {
}
}
if (included || packageElement == null) {
tree.add(HtmlTree.LI(links.createLink(
target.add(HtmlTree.LI(links.createLink(
pathToRoot.resolve(configuration.docPaths.forPackage(packageElement).resolve(DocPaths.PACKAGE_SUMMARY)),
contents.packageLabel)));
} else {
DocLink crossPkgLink = configuration.extern.getExternalLink(
packageElement, pathToRoot, DocPaths.PACKAGE_SUMMARY.getPath());
if (crossPkgLink != null) {
tree.add(HtmlTree.LI(links.createLink(crossPkgLink, contents.packageLabel)));
target.add(HtmlTree.LI(links.createLink(crossPkgLink, contents.packageLabel)));
} else {
tree.add(HtmlTree.LI(contents.packageLabel));
target.add(HtmlTree.LI(contents.packageLabel));
}
}
} else if (!configuration.packages.isEmpty()) {
addPageLabel(tree, contents.packageLabel, true);
addPageLabel(target, contents.packageLabel, true);
}
}
private void addPackageOfElementLink(Content tree) {
tree.add(HtmlTree.LI(links.createLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY),
private void addPackageOfElementLink(Content target) {
target.add(HtmlTree.LI(links.createLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY),
contents.packageLabel)));
}
private void addPackageSummaryLink(Content tree) {
tree.add(HtmlTree.LI(links.createLink(DocPaths.PACKAGE_SUMMARY, contents.packageLabel)));
private void addPackageSummaryLink(Content target) {
target.add(HtmlTree.LI(links.createLink(DocPaths.PACKAGE_SUMMARY, contents.packageLabel)));
}
private void addTreeLink(Content tree) {
private void addTreeLink(Content target) {
if (options.createTree()) {
List<PackageElement> packages = new ArrayList<>(configuration.getSpecifiedPackageElements());
DocPath docPath = packages.size() == 1 && configuration.getSpecifiedTypeElements().isEmpty()
? pathToRoot.resolve(configuration.docPaths.forPackage(packages.get(0)).resolve(DocPaths.PACKAGE_TREE))
: pathToRoot.resolve(DocPaths.OVERVIEW_TREE);
tree.add(HtmlTree.LI(links.createLink(docPath, contents.treeLabel, "")));
target.add(HtmlTree.LI(links.createLink(docPath, contents.treeLabel, "")));
}
}
private void addDeprecatedLink(Content tree) {
private void addDeprecatedLink(Content target) {
if (configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.DEPRECATED)) {
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
target.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
contents.deprecatedLabel, "")));
}
}
private void addPreviewLink(Content tree) {
private void addPreviewLink(Content target) {
if (configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.PREVIEW)) {
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.PREVIEW_LIST),
target.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.PREVIEW_LIST),
contents.previewLabel, "")));
}
}
private void addNewLink(Content tree) {
private void addNewLink(Content target) {
if (configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.NEW)) {
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.NEW_LIST),
target.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.NEW_LIST),
contents.newLabel, "")));
}
}
private void addIndexLink(Content tree) {
private void addIndexLink(Content target) {
if (options.createIndex()) {
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(
target.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(
(options.splitIndex()
? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1))
: DocPaths.INDEX_ALL)),
@ -567,7 +567,7 @@ public class Navigation {
}
}
private void addHelpLink(Content tree) {
private void addHelpLink(Content target) {
if (!options.noHelp()) {
String helpfile = options.helpFile();
DocPath helpfilenm;
@ -577,23 +577,23 @@ public class Navigation {
DocFile file = DocFile.createFileForInput(configuration, helpfile);
helpfilenm = DocPath.create(file.getName());
}
tree.add(HtmlTree.LI(links.createLink(
target.add(HtmlTree.LI(links.createLink(
new DocLink(pathToRoot.resolve(helpfilenm), htmlIds.forPage(documentedPage).name()),
contents.helpLabel, "")));
}
}
private void addSearch(Content tree) {
private void addSearch(Content target) {
String reset = "reset";
HtmlTree inputText = HtmlTree.INPUT("text", HtmlIds.SEARCH_INPUT)
var inputText = HtmlTree.INPUT("text", HtmlIds.SEARCH_INPUT)
.put(HtmlAttr.PLACEHOLDER, searchPlaceholder);
HtmlTree inputReset = HtmlTree.INPUT(reset, HtmlIds.RESET_BUTTON)
var inputReset = HtmlTree.INPUT(reset, HtmlIds.RESET_BUTTON)
.put(HtmlAttr.VALUE, reset);
HtmlTree searchDiv = HtmlTree.DIV(HtmlStyle.navListSearch,
var searchDiv = HtmlTree.DIV(HtmlStyle.navListSearch,
HtmlTree.LABEL(HtmlIds.SEARCH_INPUT.name(), searchLabel));
searchDiv.add(inputText);
searchDiv.add(inputReset);
tree.add(searchDiv);
target.add(searchDiv);
}
/**
@ -605,12 +605,12 @@ public class Navigation {
if (options.noNavbar()) {
return new ContentBuilder();
}
Content tree = HtmlTree.NAV();
var navigationBar = HtmlTree.NAV();
HtmlTree navDiv = new HtmlTree(TagName.DIV);
var navDiv = new HtmlTree(TagName.DIV);
Content skipNavLinks = contents.getContent("doclet.Skip_navigation_links");
String toggleNavLinks = configuration.getDocResources().getText("doclet.Toggle_navigation_links");
tree.add(MarkerComments.START_OF_TOP_NAVBAR);
navigationBar.add(MarkerComments.START_OF_TOP_NAVBAR);
navDiv.setStyle(HtmlStyle.topNav)
.setId(HtmlIds.NAVBAR_TOP)
.add(new HtmlTree(TagName.BUTTON).setId(HtmlIds.NAVBAR_TOGGLE_BUTTON)
@ -626,29 +626,29 @@ public class Navigation {
Content aboutContent = userHeader;
boolean addSearch = options.createIndex();
Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, aboutContent);
var aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, aboutContent);
navDiv.add(aboutDiv);
HtmlTree navList = new HtmlTree(TagName.UL)
var navList = new HtmlTree(TagName.UL)
.setId(HtmlIds.NAVBAR_TOP_FIRSTROW)
.setStyle(HtmlStyle.navList)
.put(HtmlAttr.TITLE, rowListTitle);
addMainNavLinks(navList);
navDiv.add(navList);
HtmlTree ulNavSummaryRight = HtmlTree.UL(HtmlStyle.subNavListSmall);
var ulNavSummaryRight = HtmlTree.UL(HtmlStyle.subNavListSmall);
addSummaryLinks(ulNavSummaryRight, true);
addDetailLinks(ulNavSummaryRight, true);
navDiv.add(ulNavSummaryRight);
tree.add(navDiv);
navigationBar.add(navDiv);
HtmlTree subDiv = HtmlTree.DIV(HtmlStyle.subNav);
var subDiv = HtmlTree.DIV(HtmlStyle.subNav);
HtmlTree div = new HtmlTree(TagName.DIV).setId(HtmlIds.NAVBAR_SUB_LIST);
var div = new HtmlTree(TagName.DIV).setId(HtmlIds.NAVBAR_SUB_LIST);
// Add the summary links if present.
HtmlTree ulNavSummary = HtmlTree.UL(HtmlStyle.subNavList);
var ulNavSummary = HtmlTree.UL(HtmlStyle.subNavList);
addSummaryLinks(ulNavSummary, false);
div.add(ulNavSummary);
// Add the detail links if present.
HtmlTree ulNavDetail = HtmlTree.UL(HtmlStyle.subNavList);
var ulNavDetail = HtmlTree.UL(HtmlStyle.subNavList);
addDetailLinks(ulNavDetail, false);
div.add(ulNavDetail);
subDiv.add(div);
@ -656,12 +656,12 @@ public class Navigation {
if (addSearch) {
addSearch(subDiv);
}
tree.add(subDiv);
navigationBar.add(subDiv);
tree.add(MarkerComments.END_OF_TOP_NAVBAR);
tree.add(HtmlTree.SPAN(HtmlStyle.skipNav, HtmlTree.EMPTY)
navigationBar.add(MarkerComments.END_OF_TOP_NAVBAR);
navigationBar.add(HtmlTree.SPAN(HtmlStyle.skipNav, HtmlTree.EMPTY)
.setId(HtmlIds.SKIP_NAVBAR_TOP));
return tree;
return navigationBar;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -60,11 +60,11 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
@Override
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_NESTED_CLASS_SUMMARY);
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;
Content content) {
content.add(MarkerComments.START_OF_NESTED_CLASS_SUMMARY);
Content memberContent = new ContentBuilder();
writer.addSummaryHeader(this, memberContent);
return memberContent;
}
@Override
@ -74,10 +74,10 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
}
@Override
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
public void addSummaryLabel(Content content) {
var label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
contents.nestedClassSummary);
memberTree.add(label);
content.add(label);
}
@Override
@ -100,7 +100,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
}
@Override
public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
public void addInheritedSummaryLabel(TypeElement typeElement, Content content) {
Content classLink = writer.getPreQualifiedClassLink(HtmlLinkInfo.Kind.MEMBER, typeElement);
Content label;
if (options.summarizeOverriddenMethods()) {
@ -112,32 +112,32 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
? resources.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Interface")
: resources.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
}
HtmlTree labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, label);
var labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, label);
labelHeading.setId(htmlIds.forInheritedClasses(typeElement));
labelHeading.add(Entity.NO_BREAK_SPACE);
labelHeading.add(classLink);
inheritedTree.add(labelHeading);
content.add(labelHeading);
}
@Override
protected void addSummaryLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Element member,
Content tdSummary) {
Content content) {
Content memberLink = writer.getLink(new HtmlLinkInfo(configuration, context, (TypeElement)member)
.style(HtmlStyle.typeNameLink));
Content code = HtmlTree.CODE(memberLink);
tdSummary.add(code);
var code = HtmlTree.CODE(memberLink);
content.add(code);
}
@Override
protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content linksTree) {
linksTree.add(
protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content target) {
target.add(
writer.getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.MEMBER,
(TypeElement)member)));
}
@Override
protected void addSummaryType(Element member, Content tdSummaryType) {
addModifierAndType(member, null, tdSummaryType);
protected void addSummaryType(Element member, Content content) {
addModifiersAndType(member, null, content);
}
@Override

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -82,10 +82,10 @@ public class PackageIndexWriter extends AbstractOverviewIndexWriter {
/**
* Adds the packages list to the documentation tree.
*
* @param main the documentation tree to which the packages list will be added
* @param target the content to which the packages list will be added
*/
@Override
protected void addIndex(Content main) {
protected void addIndex(Content target) {
Map<String, SortedSet<PackageElement>> groupPackageMap
= configuration.group.groupPackages(packages);
@ -113,7 +113,7 @@ public class PackageIndexWriter extends AbstractOverviewIndexWriter {
}
}
main.add(table);
target.add(table);
if (table.needsScript()) {
getMainBodyScript().append(table.getScript());

View File

@ -90,7 +90,8 @@ public class PackageTreeWriter extends AbstractTreeWriter {
}
/**
* Generate a separate tree file for each package.
* Generate a separate tree file.
*
* @throws DocFileIOException if there is a problem generating the package tree file
*/
protected void generatePackageTreeFile() throws DocFileIOException {
@ -100,11 +101,11 @@ public class PackageTreeWriter extends AbstractTreeWriter {
? contents.getContent("doclet.Hierarchy_For_Unnamed_Package")
: contents.getContent("doclet.Hierarchy_For_Package",
getLocalizedPackageName(packageElement));
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
var heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
var div = HtmlTree.DIV(HtmlStyle.header, heading);
if (configuration.packages.size() > 1) {
addLinkToMainTree(div);
addLinkToAllPackages(div);
}
mainContent.add(div);
addTree(classtree.baseClasses(), "doclet.Class_Hierarchy", mainContent);
@ -120,14 +121,14 @@ public class PackageTreeWriter extends AbstractTreeWriter {
/**
* Get the package tree header.
*
* @return a content tree for the header
* @return the package tree header
*/
protected HtmlTree getPackageTreeHeader() {
String packageName = packageElement.isUnnamed() ? "" : utils.getPackageName(packageElement);
String title = packageName + " " + resources.getText("doclet.Window_Class_Hierarchy");
HtmlTree bodyTree = getBody(getWindowTitle(title));
HtmlTree body = getBody(getWindowTitle(title));
bodyContents.setHeader(getHeader(PageMode.TREE, packageElement));
return bodyTree;
return body;
}
@Override
@ -141,14 +142,16 @@ public class PackageTreeWriter extends AbstractTreeWriter {
/**
* Add a link to the tree for all the packages.
*
* @param div the content tree to which the link will be added
* @param target the content to which the link will be added
*/
protected void addLinkToMainTree(Content div) {
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
protected void addLinkToAllPackages(Content target) {
var span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
contents.packageHierarchies);
div.add(span);
HtmlTree ul = HtmlTree.UL(HtmlStyle.horizontal);
ul.add(getNavLinkMainTree(resources.getText("doclet.All_Packages")));
div.add(ul);
target.add(span);
var ul = HtmlTree.UL(HtmlStyle.horizontal);
// TODO the link should be more specific:
// it should point to the "all packages" section of the overview tree
ul.add(getNavLinkToOverviewTree(resources.getText("doclet.All_Packages")));
target.add(ul);
}
}

View File

@ -116,7 +116,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
* @throws DocFileIOException if there is a problem generating the package use page
*/
protected void generatePackageUseFile() throws DocFileIOException {
HtmlTree body = getPackageUseHeader();
HtmlTree body = getBody();
Content mainContent = new ContentBuilder();
if (usingPackageToUsedClasses.isEmpty()) {
mainContent.add(contents.getContent("doclet.ClassUse_No.usage.of.0", getLocalizedPackageName(packageElement)));
@ -134,23 +134,23 @@ public class PackageUseWriter extends SubWriterHolderWriter {
/**
* Add the package use information.
*
* @param contentTree the content tree to which the package use information will be added
* @param content the content to which the package use information will be added
*/
protected void addPackageUse(Content contentTree) {
Content content = new ContentBuilder();
protected void addPackageUse(Content content) {
Content c = new ContentBuilder();
if (configuration.packages.size() > 1) {
addPackageList(content);
addPackageList(c);
}
addClassList(content);
contentTree.add(content);
addClassList(c);
content.add(c);
}
/**
* Add the list of packages that use the given package.
*
* @param contentTree the content tree to which the package list will be added
* @param content the content to which the package list will be added
*/
protected void addPackageList(Content contentTree) {
protected void addPackageList(Content content) {
Content caption = contents.getContent(
"doclet.ClassUse_Packages.that.use.0",
getPackageLink(packageElement, getLocalizedPackageName(packageElement)));
@ -170,21 +170,21 @@ public class PackageUseWriter extends SubWriterHolderWriter {
}
table.addRow(packageLink, summary);
}
contentTree.add(table);
content.add(table);
}
/**
* Add the list of classes that use the given package.
*
* @param contentTree the content tree to which the class list will be added
* @param content the content to which the class list will be added
*/
protected void addClassList(Content contentTree) {
protected void addClassList(Content content) {
TableHeader classTableHeader = new TableHeader(
contents.classLabel, contents.descriptionLabel);
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList);
var ul = HtmlTree.UL(HtmlStyle.blockList);
for (String packageName : usingPackageToUsedClasses.keySet()) {
PackageElement usingPackage = utils.elementUtils.getPackageElement(packageName);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.detail)
var section = HtmlTree.SECTION(HtmlStyle.detail)
.setId(htmlIds.forPackage(usingPackage));
Content caption = contents.getContent(
"doclet.ClassUse_Classes.in.0.used.by.1",
@ -208,30 +208,28 @@ public class PackageUseWriter extends SubWriterHolderWriter {
section.add(table);
ul.add(HtmlTree.LI(section));
}
Content li = HtmlTree.SECTION(HtmlStyle.packageUses, ul);
contentTree.add(li);
var li = HtmlTree.SECTION(HtmlStyle.packageUses, ul);
content.add(li);
}
/**
* Get the header for the package use listing.
*
* @return a content tree representing the package use header
* {@return the package use HTML BODY element}
*/
private HtmlTree getPackageUseHeader() {
private HtmlTree getBody() {
String packageText = resources.getText("doclet.Package");
String name = packageElement.isUnnamed() ? "" : utils.getPackageName(packageElement);
String title = resources.getText("doclet.Window_ClassUse_Header", packageText, name);
HtmlTree bodyTree = getBody(getWindowTitle(title));
HtmlTree body = getBody(getWindowTitle(title));
ContentBuilder headingContent = new ContentBuilder();
headingContent.add(contents.getContent("doclet.ClassUse_Title", packageText));
headingContent.add(new HtmlTree(TagName.BR));
headingContent.add(name);
Content heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, headingContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
var div = HtmlTree.DIV(HtmlStyle.header, heading);
bodyContents.setHeader(getHeader(PageMode.USE, packageElement))
.addMainContent(div);
return bodyTree;
return body;
}
@Override

View File

@ -77,9 +77,9 @@ public class PackageWriterImpl extends HtmlDocletWriter
private SortedSet<TypeElement> allClasses;
/**
* The HTML tree for section tag.
* The HTML element for the section tag being written.
*/
protected HtmlTree sectionTree = HtmlTree.SECTION(HtmlStyle.packageDescription, new ContentBuilder());
private final HtmlTree section = HtmlTree.SECTION(HtmlStyle.packageDescription, new ContentBuilder());
private final BodyContents bodyContents = new BodyContents();
@ -110,12 +110,12 @@ public class PackageWriterImpl extends HtmlDocletWriter
@Override
public Content getPackageHeader() {
String packageName = getLocalizedPackageName(packageElement).toString();
HtmlTree bodyTree = getBody(getWindowTitle(packageName));
HtmlTree div = HtmlTree.DIV(HtmlStyle.header);
HtmlTree body = getBody(getWindowTitle(packageName));
var div = HtmlTree.DIV(HtmlStyle.header);
if (configuration.showModules) {
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement);
Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInPackage, contents.moduleLabel);
Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
var classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInPackage, contents.moduleLabel);
var moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
moduleNameDiv.add(Entity.NO_BREAK_SPACE);
moduleNameDiv.add(getModuleLink(mdle,
Text.of(mdle.getQualifiedName().toString())));
@ -126,12 +126,12 @@ public class PackageWriterImpl extends HtmlDocletWriter
packageHead.add(contents.packageLabel).add(" ");
}
packageHead.add(packageName);
Content tHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var tHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, packageHead);
div.add(tHeading);
bodyContents.setHeader(getHeader(PageMode.PACKAGE, packageElement))
.addMainContent(div);
return bodyTree;
return body;
}
@Override
@ -205,14 +205,14 @@ public class PackageWriterImpl extends HtmlDocletWriter
/**
* Add the package deprecation information to the documentation tree.
*
* @param div the content tree to which the deprecation information will be added
* @param div the content to which the deprecation information will be added
*/
public void addDeprecationInfo(Content div) {
List<? extends DeprecatedTree> deprs = utils.getDeprecatedTrees(packageElement);
if (utils.isDeprecated(packageElement)) {
CommentHelper ch = utils.getCommentHelper(packageElement);
HtmlTree deprDiv = HtmlTree.DIV(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
var deprDiv = HtmlTree.DIV(HtmlStyle.deprecationBlock);
var deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
deprDiv.add(deprPhrase);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(deprs.get(0));
@ -230,22 +230,22 @@ public class PackageWriterImpl extends HtmlDocletWriter
}
@Override
public void addRelatedPackagesSummary(Content summaryContentTree) {
public void addRelatedPackagesSummary(Content summaryContent) {
boolean showModules = configuration.showModules && hasRelatedPackagesInOtherModules(relatedPackages);
TableHeader tableHeader= showModules
? new TableHeader(contents.moduleLabel, contents.packageLabel, contents.descriptionLabel)
: new TableHeader(contents.packageLabel, contents.descriptionLabel);
addPackageSummary(relatedPackages, contents.relatedPackages, tableHeader,
summaryContentTree, showModules);
summaryContent, showModules);
}
/**
* Add all types to the content tree.
* Add all types to the content.
*
* @param summaryContentTree HtmlTree content to which the links will be added
* @param target the content to which the links will be added
*/
public void addAllClassesAndInterfacesSummary(Content summaryContentTree) {
public void addAllClassesAndInterfacesSummary(Content target) {
Table table = new Table(HtmlStyle.summaryTable)
.setHeader(new TableHeader(contents.classLabel, contents.descriptionLabel))
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast)
@ -276,7 +276,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
}
}
if (!table.isEmpty()) {
summaryContentTree.add(HtmlTree.LI(table));
target.add(HtmlTree.LI(table));
if (table.needsScript()) {
getMainBodyScript().append(table.getScript());
}
@ -284,7 +284,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
}
public void addPackageSummary(List<PackageElement> packages, Content label,
TableHeader tableHeader, Content summaryContentTree,
TableHeader tableHeader, Content summaryContent,
boolean showModules) {
if (!packages.isEmpty()) {
Table table = new Table(HtmlStyle.summaryTable)
@ -299,7 +299,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
for (PackageElement pkg : packages) {
Content packageLink = getPackageLink(pkg, Text.of(pkg.getQualifiedName()));
Content moduleLink = HtmlTree.EMPTY;
var moduleLink = HtmlTree.EMPTY;
if (showModules) {
ModuleElement module = (ModuleElement) pkg.getEnclosingElement();
if (module != null && !module.isUnnamed()) {
@ -323,37 +323,35 @@ public class PackageWriterImpl extends HtmlDocletWriter
table.addRow(packageLink, description);
}
}
summaryContentTree.add(HtmlTree.LI(table));
summaryContent.add(HtmlTree.LI(table));
}
}
@Override
public void addPackageDescription(Content packageContentTree) {
addPreviewInfo(packageElement, packageContentTree);
public void addPackageDescription(Content packageContent) {
addPreviewInfo(packageElement, packageContent);
if (!utils.getBody(packageElement).isEmpty()) {
HtmlTree tree = sectionTree;
tree.setId(HtmlIds.PACKAGE_DESCRIPTION);
addDeprecationInfo(tree);
addInlineComment(packageElement, tree);
section.setId(HtmlIds.PACKAGE_DESCRIPTION);
addDeprecationInfo(section);
addInlineComment(packageElement, section);
}
}
@Override
public void addPackageTags(Content packageContentTree) {
Content htmlTree = sectionTree;
addTagsInfo(packageElement, htmlTree);
packageContentTree.add(sectionTree);
public void addPackageTags(Content packageContent) {
addTagsInfo(packageElement, section);
packageContent.add(section);
}
@Override
public void addPackageSignature(Content packageContentTree) {
packageContentTree.add(new HtmlTree(TagName.HR));
packageContentTree.add(Signatures.getPackageSignature(packageElement, this));
public void addPackageSignature(Content packageContent) {
packageContent.add(new HtmlTree(TagName.HR));
packageContent.add(Signatures.getPackageSignature(packageElement, this));
}
@Override
public void addPackageContent(Content packageContentTree) {
bodyContents.addMainContent(packageContentTree);
public void addPackageContent(Content packageContent) {
bodyContents.addMainContent(packageContent);
}
@Override
@ -362,17 +360,17 @@ public class PackageWriterImpl extends HtmlDocletWriter
}
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
public void printDocument(Content content) throws DocFileIOException {
String description = getDescription("declaration", packageElement);
List<DocPath> localStylesheets = getLocalStylesheets(packageElement);
contentTree.add(bodyContents);
content.add(bodyContents);
printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement),
description, localStylesheets, contentTree);
description, localStylesheets, content);
}
@Override
public Content getPackageSummary(Content summaryContentTree) {
return HtmlTree.SECTION(HtmlStyle.summary, summaryContentTree);
public Content getPackageSummary(Content summaryContent) {
return HtmlTree.SECTION(HtmlStyle.summary, summaryContent);
}
private boolean hasRelatedPackagesInOtherModules(List<PackageElement> relatedPackages) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -54,11 +54,11 @@ public class PropertyWriterImpl extends AbstractMemberWriter
}
@Override
public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_PROPERTY_SUMMARY);
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;
public Content getMemberSummaryHeader(TypeElement typeElement, Content content) {
content.add(MarkerComments.START_OF_PROPERTY_SUMMARY);
Content memberContent = new ContentBuilder();
writer.addSummaryHeader(this, memberContent);
return memberContent;
}
@Override
@ -68,22 +68,22 @@ public class PropertyWriterImpl extends AbstractMemberWriter
}
@Override
public Content getPropertyDetailsTreeHeader(Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_PROPERTY_DETAILS);
Content propertyDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
public Content getPropertyDetailsHeader(Content memberDetails) {
memberDetails.add(MarkerComments.START_OF_PROPERTY_DETAILS);
Content propertyDetailsContent = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.propertyDetailsLabel);
propertyDetailsTree.add(heading);
return propertyDetailsTree;
propertyDetailsContent.add(heading);
return propertyDetailsContent;
}
@Override
public Content getPropertyDocTreeHeader(ExecutableElement property) {
Content propertyDocTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
public Content getPropertyHeaderContent(ExecutableElement property) {
Content content = new ContentBuilder();
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
Text.of(utils.getPropertyLabel(name(property))));
propertyDocTree.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, propertyDocTree)
content.add(heading);
return HtmlTree.SECTION(HtmlStyle.detail, content)
.setId(htmlIds.forProperty(property));
}
@ -96,20 +96,20 @@ public class PropertyWriterImpl extends AbstractMemberWriter
}
@Override
public void addDeprecated(ExecutableElement property, Content propertyDocTree) {
public void addDeprecated(ExecutableElement property, Content propertyContent) {
}
@Override
public void addPreview(ExecutableElement property, Content propertyDocTree) {
public void addPreview(ExecutableElement property, Content content) {
}
@Override
public void addComments(ExecutableElement property, Content propertyDocTree) {
public void addComments(ExecutableElement property, Content propertyContent) {
TypeElement holder = (TypeElement)property.getEnclosingElement();
if (!utils.getFullBody(property).isEmpty()) {
if (holder.equals(typeElement) ||
(!utils.isPublic(holder) || utils.isLinkable(holder))) {
writer.addInlineComment(property, propertyDocTree);
writer.addInlineComment(property, propertyContent);
} else {
if (!utils.hasHiddenTag(holder) && !utils.hasHiddenTag(property)) {
Content link =
@ -117,39 +117,39 @@ public class PropertyWriterImpl extends AbstractMemberWriter
holder, property,
utils.isIncluded(holder)
? holder.getSimpleName() : holder.getQualifiedName());
Content codeLink = HtmlTree.CODE(link);
Content descriptionFromLabel = HtmlTree.SPAN(HtmlStyle.descriptionFromTypeLabel,
var codeLink = HtmlTree.CODE(link);
var descriptionFromLabel = HtmlTree.SPAN(HtmlStyle.descriptionFromTypeLabel,
utils.isClass(holder)
? contents.descriptionFromClassLabel
: contents.descriptionFromInterfaceLabel);
descriptionFromLabel.add(Entity.NO_BREAK_SPACE);
descriptionFromLabel.add(codeLink);
propertyDocTree.add(HtmlTree.DIV(HtmlStyle.block, descriptionFromLabel));
propertyContent.add(HtmlTree.DIV(HtmlStyle.block, descriptionFromLabel));
}
writer.addInlineComment(property, propertyDocTree);
writer.addInlineComment(property, propertyContent);
}
}
}
@Override
public void addTags(ExecutableElement property, Content propertyDocTree) {
writer.addTagsInfo(property, propertyDocTree);
public void addTags(ExecutableElement property, Content propertyContent) {
writer.addTagsInfo(property, propertyContent);
}
@Override
public Content getPropertyDetails(Content propertyDetailsTreeHeader, Content propertyDetailsTree) {
public Content getPropertyDetails(Content memberDetailsHeader, Content memberDetails) {
return writer.getDetailsListItem(
HtmlTree.SECTION(HtmlStyle.propertyDetails)
.setId(HtmlIds.PROPERTY_DETAIL)
.add(propertyDetailsTreeHeader)
.add(propertyDetailsTree));
.add(memberDetailsHeader)
.add(memberDetails));
}
@Override
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
public void addSummaryLabel(Content content) {
var label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING,
contents.propertySummaryLabel);
memberTree.add(label);
content.add(label);
}
@Override
@ -167,7 +167,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
}
@Override
public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
public void addInheritedSummaryLabel(TypeElement typeElement, Content content) {
Content classLink = writer.getPreQualifiedClassLink(
HtmlLinkInfo.Kind.MEMBER, typeElement);
Content label;
@ -180,38 +180,38 @@ public class PropertyWriterImpl extends AbstractMemberWriter
? resources.getText("doclet.Properties_Inherited_From_Class")
: resources.getText("doclet.Properties_Inherited_From_Interface"));
}
HtmlTree labelHeading =
var labelHeading =
HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING, label)
.setId(htmlIds.forInheritedProperties(typeElement))
.add(Entity.NO_BREAK_SPACE)
.add(classLink);
inheritedTree.add(labelHeading);
content.add(labelHeading);
}
@Override
protected void addSummaryLink(HtmlLinkInfo.Kind context, TypeElement typeElement, Element member,
Content tdSummary) {
Content content) {
Content memberLink = writer.getDocLink(context, typeElement,
member,
Text.of(utils.getPropertyLabel(name(member))),
HtmlStyle.memberNameLink,
true);
Content code = HtmlTree.CODE(memberLink);
tdSummary.add(code);
var code = HtmlTree.CODE(memberLink);
content.add(code);
}
@Override
protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content linksTree) {
protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content target) {
String mname = name(member);
Content content = writer.getDocLink(HtmlLinkInfo.Kind.MEMBER, typeElement, member,
utils.isProperty(mname) ? utils.getPropertyName(mname) : mname, true);
linksTree.add(content);
target.add(content);
}
@Override
protected void addSummaryType(Element member, Content tdSummaryType) {
addModifierAndType(member, utils.getReturnType(typeElement, (ExecutableElement)member), tdSummaryType);
protected void addSummaryType(Element member, Content content) {
addModifiersAndType(member, utils.getReturnType(typeElement, (ExecutableElement)member), content);
}
@Override
@ -220,8 +220,4 @@ public class PropertyWriterImpl extends AbstractMemberWriter
utils.getFullyQualifiedName(member));
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
}
}

View File

@ -68,24 +68,24 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
* Get the given header.
*
* @param header the header to write
* @return the body content tree
* @return the body content
*/
@Override
public Content getHeader(String header) {
HtmlTree bodyTree = getBody(getWindowTitle(header));
HtmlTree body = getBody(getWindowTitle(header));
Content h1Content = Text.of(header);
Content heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, h1Content);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
var div = HtmlTree.DIV(HtmlStyle.header, heading);
bodyContents.setHeader(getHeader(PageMode.SERIALIZED_FORM))
.addMainContent(div);
return bodyTree;
return body;
}
/**
* Get the serialized form summaries header.
*
* @return the serialized form summary header tree
* @return the serialized form summaries header
*/
@Override
public Content getSerializedSummariesHeader() {
@ -102,30 +102,18 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
return HtmlTree.SECTION(HtmlStyle.serializedPackageContainer);
}
/**
* Get the given package header.
*
* @param packageElement the package element to write
* @return a content tree for the package header
*/
@Override
public Content getPackageHeader(PackageElement packageElement) {
Content heading = HtmlTree.HEADING_TITLE(Headings.SerializedForm.PACKAGE_HEADING,
var heading = HtmlTree.HEADING_TITLE(Headings.SerializedForm.PACKAGE_HEADING,
contents.packageLabel);
heading.add(Entity.NO_BREAK_SPACE);
heading.add(getPackageLink(packageElement, Text.of(utils.getPackageName(packageElement))));
return heading;
}
/**
* Get the serialized class header.
*
* @return a content tree for the serialized class header
*/
@Override
public Content getClassSerializedHeader() {
return HtmlTree.UL(HtmlStyle.blockList);
}
/**
@ -139,19 +127,13 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
&& !utils.hasHiddenTag(typeElement);
}
/**
* Get the serializable class heading.
*
* @param typeElement the class being processed
* @return a content tree for the class header
*/
@Override
public Content getClassHeader(TypeElement typeElement) {
Content classLink = (isVisibleClass(typeElement))
? getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.DEFAULT, typeElement)
.label(configuration.getClassName(typeElement)))
: Text.of(utils.getFullyQualifiedName(typeElement));
Content section = HtmlTree.SECTION(HtmlStyle.serializedClassDetails)
var section = HtmlTree.SECTION(HtmlStyle.serializedClassDetails)
.setId(htmlIds.forClass(typeElement));
Content superClassLink = typeElement.getSuperclass() != null
? getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.SERIALIZED_FORM,
@ -180,11 +162,6 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
return section;
}
/**
* Get the serial UID info header.
*
* @return a content tree for the serial uid info header
*/
@Override
public Content getSerialUIDInfoHeader() {
return HtmlTree.DL(HtmlStyle.nameValue);
@ -195,46 +172,40 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
*
* @param header the header that will show up before the UID.
* @param serialUID the serial UID to print.
* @param serialUidTree the serial UID content tree to which the serial UID
* content will be added
* @param target the serial UID content to which the serial UID
* content will be added
*/
@Override
public void addSerialUIDInfo(String header,
String serialUID,
Content serialUidTree)
Content target)
{
Content headerContent = Text.of(header);
serialUidTree.add(HtmlTree.DT(headerContent));
target.add(HtmlTree.DT(headerContent));
Content serialContent = Text.of(serialUID);
serialUidTree.add(HtmlTree.DD(serialContent));
target.add(HtmlTree.DD(serialContent));
}
/**
* Get the class serialize content header.
*
* @return a content tree for the class serialize content header
*/
@Override
public Content getClassContentHeader() {
return HtmlTree.UL(HtmlStyle.blockList);
}
/**
* Add the serialized content tree section.
* Add the serialized content section.
*
* @param serializedTreeContent the serialized content tree to be added
* @param source the serialized content to be added
*/
@Override
public void addSerializedContent(Content serializedTreeContent) {
bodyContents.addMainContent(serializedTreeContent);
public void addSerializedContent(Content source) {
bodyContents.addMainContent(source);
}
@Override
public void addPackageSerializedTree(Content serializedSummariesTree,
Content packageSerializedTree)
public void addPackageSerialized(Content serializedSummaries,
Content packageSerialized)
{
serializedSummariesTree.add(HtmlTree.LI(packageSerializedTree));
serializedSummaries.add(HtmlTree.LI(packageSerialized));
}
/**
@ -246,9 +217,9 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
}
@Override
public void printDocument(Content serializedTree) throws DocFileIOException {
serializedTree.add(bodyContents);
printHtmlDocument(null, "serialized forms", serializedTree);
public void printDocument(Content source) throws DocFileIOException {
source.add(bodyContents);
printHtmlDocument(null, "serialized forms", source);
if (configuration.mainIndex != null) {
configuration.mainIndex.add(IndexItem.of(IndexItem.Category.TAGS,

View File

@ -65,7 +65,7 @@ import static javax.lang.model.element.Modifier.SYNCHRONIZED;
public class Signatures {
public static Content getModuleSignature(ModuleElement mdle, ModuleWriterImpl moduleWriter) {
Content signature = HtmlTree.DIV(HtmlStyle.moduleSignature);
var signature = HtmlTree.DIV(HtmlStyle.moduleSignature);
Content annotations = moduleWriter.getAnnotationInfo(mdle, true);
if (!annotations.isEmpty()) {
signature.add(HtmlTree.SPAN(HtmlStyle.annotations, annotations));
@ -75,7 +75,7 @@ public class Signatures {
? "open module" : "module";
signature.add(label);
signature.add(" ");
HtmlTree nameSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.elementName);
var nameSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.elementName);
nameSpan.add(mdle.getQualifiedName().toString());
signature.add(nameSpan);
return signature;
@ -85,13 +85,13 @@ public class Signatures {
if (pkg.isUnnamed()) {
return Text.EMPTY;
}
Content signature = HtmlTree.DIV(HtmlStyle.packageSignature);
var signature = HtmlTree.DIV(HtmlStyle.packageSignature);
Content annotations = pkgWriter.getAnnotationInfo(pkg, true);
if (!annotations.isEmpty()) {
signature.add(HtmlTree.SPAN(HtmlStyle.annotations, annotations));
}
signature.add("package ");
HtmlTree nameSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.elementName);
var nameSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.elementName);
nameSpan.add(pkg.getQualifiedName().toString());
signature.add(nameSpan);
return signature;
@ -128,7 +128,7 @@ public class Signatures {
}
content.add(HtmlTree.SPAN(HtmlStyle.modifiers, modifiers));
HtmlTree nameSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.elementName);
var nameSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.elementName);
Content className = Text.of(utils.getSimpleName(typeElement));
if (configuration.getOptions().linkSource()) {
writer.addSrcLink(typeElement, className, nameSpan);
@ -146,7 +146,7 @@ public class Signatures {
content.add(getRecordComponents());
}
if (!utils.isAnnotationType(typeElement)) {
Content extendsImplements = new HtmlTree(TagName.SPAN)
var extendsImplements = new HtmlTree(TagName.SPAN)
.setStyle(HtmlStyle.extendsImplements);
if (!utils.isInterface(typeElement)) {
TypeMirror superclass = utils.getFirstVisibleSuperClass(typeElement);
@ -189,7 +189,7 @@ public class Signatures {
.filter(t -> utils.isLinkable(utils.asTypeElement(t)))
.toList();
if (!linkablePermits.isEmpty()) {
Content permitsSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.permits);
var permitsSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.permits);
boolean isFirst = true;
for (TypeMirror type : linkablePermits) {
if (isFirst) {
@ -378,7 +378,7 @@ public class Signatures {
/**
* Set the type parameters for an executable member.
*
* @param typeParameters the content tree containing the type parameters to add.
* @param typeParameters the type parameters to add.
* @return this instance
*/
MemberSignature setTypeParameters(Content typeParameters) {
@ -389,7 +389,7 @@ public class Signatures {
/**
* Set the return type for an executable member.
*
* @param returnType the content tree containing the return type to add.
* @param returnType the return type to add.
* @return this instance
*/
MemberSignature setReturnType(Content returnType) {
@ -411,33 +411,33 @@ public class Signatures {
/**
* Set the parameter information of an executable member.
*
* @param paramTree the content tree containing the parameter information.
* @param content the parameter information.
* @return this instance
*/
MemberSignature setParameters(Content paramTree) {
this.parameters = paramTree;
MemberSignature setParameters(Content content) {
this.parameters = content;
return this;
}
/**
* Set the exception information of an executable member.
*
* @param exceptionTree the content tree containing the exception information
* @param content the exception information
* @return this instance
*/
MemberSignature setExceptions(Content exceptionTree) {
this.exceptions = exceptionTree;
MemberSignature setExceptions(Content content) {
this.exceptions = content;
return this;
}
/**
* Set the annotation information of a member.
*
* @param annotationTree the content tree containing the exception information
* @param content the exception information
* @return this instance
*/
MemberSignature setAnnotations(Content annotationTree) {
this.annotations = annotationTree;
MemberSignature setAnnotations(Content content) {
this.annotations = content;
return this;
}
@ -472,7 +472,7 @@ public class Signatures {
}
// Name
HtmlTree nameSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.elementName);
var nameSpan = new HtmlTree(TagName.SPAN).setStyle(HtmlStyle.elementName);
if (memberWriter.options.linkSource()) {
Content name = Text.of(memberWriter.name(element));
memberWriter.writer.addSrcLink(element, name, nameSpan);
@ -490,12 +490,12 @@ public class Signatures {
}
/**
* Adds the modifier for the member. The modifiers are ordered as specified
* Adds the modifiers for the member. The modifiers are ordered as specified
* by <em>The Java Language Specification</em>.
*
* @param htmlTree the content tree to which the modifier information will be added
* @param target the content to which the modifier information will be added
*/
private void appendModifiers(Content htmlTree) {
private void appendModifiers(Content target) {
Set<Modifier> set = new TreeSet<>(element.getModifiers());
// remove the ones we really don't need
@ -517,7 +517,7 @@ public class Signatures {
}
if (!set.isEmpty()) {
String mods = set.stream().map(Modifier::toString).collect(Collectors.joining(" "));
htmlTree.add(HtmlTree.SPAN(HtmlStyle.modifiers, Text.of(mods)))
target.add(HtmlTree.SPAN(HtmlStyle.modifiers, Text.of(mods)))
.add(Entity.NO_BREAK_SPACE);
}
}
@ -525,30 +525,30 @@ public class Signatures {
/**
* Appends the type parameter information to the HTML tree.
*
* @param htmlTree the HTML tree
* @param target the HTML tree
* @param lastLineSeparator index of last line separator in the HTML tree
* @return the new index of the last line separator
*/
private int appendTypeParameters(Content htmlTree, int lastLineSeparator) {
private int appendTypeParameters(Content target, int lastLineSeparator) {
// Apply different wrapping strategies for type parameters
// depending of combined length of type parameters and return type.
int typeParamLength = typeParameters.charCount();
if (typeParamLength >= TYPE_PARAMS_MAX_INLINE_LENGTH) {
htmlTree.add(HtmlTree.SPAN(HtmlStyle.typeParametersLong, typeParameters));
target.add(HtmlTree.SPAN(HtmlStyle.typeParametersLong, typeParameters));
} else {
htmlTree.add(HtmlTree.SPAN(HtmlStyle.typeParameters, typeParameters));
target.add(HtmlTree.SPAN(HtmlStyle.typeParameters, typeParameters));
}
int lineLength = htmlTree.charCount() - lastLineSeparator;
int lineLength = target.charCount() - lastLineSeparator;
int newLastLineSeparator = lastLineSeparator;
// sum below includes length of modifiers plus type params added above
if (lineLength + returnType.charCount() > RETURN_TYPE_MAX_LINE_LENGTH) {
htmlTree.add(DocletConstants.NL);
newLastLineSeparator = htmlTree.charCount();
target.add(DocletConstants.NL);
newLastLineSeparator = target.charCount();
} else {
htmlTree.add(Entity.NO_BREAK_SPACE);
target.add(Entity.NO_BREAK_SPACE);
}
return newLastLineSeparator;
@ -557,25 +557,25 @@ public class Signatures {
/**
* Appends the parameters and exceptions information to the HTML tree.
*
* @param htmlTree the HTML tree
* @param target the HTML tree
* @param lastLineSeparator the index of the last line separator in the HTML tree
*/
private void appendParametersAndExceptions(Content htmlTree, int lastLineSeparator) {
private void appendParametersAndExceptions(Content target, int lastLineSeparator) {
// Record current position for indentation of exceptions
int indentSize = htmlTree.charCount() - lastLineSeparator;
int indentSize = target.charCount() - lastLineSeparator;
if (parameters.charCount() == 2) {
// empty parameters are added without packing
htmlTree.add(parameters);
target.add(parameters);
} else {
htmlTree.add(new HtmlTree(TagName.WBR))
target.add(new HtmlTree(TagName.WBR))
.add(HtmlTree.SPAN(HtmlStyle.parameters, parameters));
}
// Exceptions
if (exceptions != null && !exceptions.isEmpty()) {
CharSequence indent = " ".repeat(Math.max(0, indentSize + 1 - 7));
htmlTree.add(DocletConstants.NL)
target.add(DocletConstants.NL)
.add(indent)
.add("throws ")
.add(HtmlTree.SPAN(HtmlStyle.exceptions, exceptions));

View File

@ -207,8 +207,8 @@ public class SourceToHTMLConverter {
.resolve(configuration.docPaths.forPackage(te))
.invert();
Content body = getHeader();
Content pre = new HtmlTree(TagName.PRE);
try (LineNumberReader reader = new LineNumberReader(r)) {
var pre = new HtmlTree(TagName.PRE);
try (var reader = new LineNumberReader(r)) {
while ((line = reader.readLine()) != null) {
addLineNo(pre, lineno);
addLine(pre, line, lineno);
@ -216,7 +216,7 @@ public class SourceToHTMLConverter {
}
}
addBlankLines(pre);
Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
var div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
body.add(HtmlTree.MAIN(div));
writeToFile(body, outputdir.resolve(configuration.docPaths.forClass(te)), te);
} catch (IOException e) {
@ -240,16 +240,16 @@ public class SourceToHTMLConverter {
.setGenerator(HtmlDocletWriter.getGenerator(getClass()))
.addDefaultScript(false)
.setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets());
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
HtmlDocument htmlDocument = new HtmlDocument(htmlTree);
var html = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
HtmlDocument document = new HtmlDocument(html);
messages.notice("doclet.Generating_0", path.getPath());
htmlDocument.write(DocFile.createFileForOutput(configuration, path));
document.write(DocFile.createFileForOutput(configuration, path));
}
/**
* Returns a link to the stylesheet file.
*
* @param head an HtmlTree to which the stylesheet links will be added
* @param head the content to which the stylesheet links will be added
*/
public void addStyleSheetProperties(Content head) {
String filename = options.stylesheetFile();
@ -261,18 +261,18 @@ public class SourceToHTMLConverter {
stylesheet = DocPaths.STYLESHEET;
}
DocPath p = relativePath.resolve(stylesheet);
HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style");
var link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style");
head.add(link);
addStylesheets(head);
}
protected void addStylesheets(Content tree) {
protected void addStylesheets(Content head) {
options.additionalStylesheets().forEach(css -> {
DocFile file = DocFile.createFileForInput(configuration, css);
DocPath cssPath = DocPath.create(file.getName());
HtmlTree slink = HtmlTree.LINK("stylesheet", "text/css", relativePath.resolve(cssPath).getPath(),
"Style");
tree.add(slink);
var slink = HtmlTree.LINK("stylesheet", "text/css", relativePath.resolve(cssPath).getPath(),
"Style");
head.add(slink);
});
}
@ -288,11 +288,11 @@ public class SourceToHTMLConverter {
/**
* Add the line numbers for the source code.
*
* @param pre the content tree to which the line number will be added
* @param pre the content to which the line number will be added
* @param lineno The line number
*/
private static void addLineNo(Content pre, int lineno) {
HtmlTree span = new HtmlTree(TagName.SPAN);
var span = new HtmlTree(TagName.SPAN);
span.setStyle(HtmlStyle.sourceLineNo);
if (lineno < 10) {
span.add("00" + Integer.toString(lineno));
@ -307,13 +307,13 @@ public class SourceToHTMLConverter {
/**
* Add a line from source to the HTML file that is generated.
*
* @param pre the content tree to which the line will be added.
* @param pre the content to which the line will be added.
* @param line the string to format.
* @param currentLineNo the current number.
*/
private void addLine(Content pre, String line, int currentLineNo) {
if (line != null) {
Content anchor = HtmlTree.SPAN_ID(
var anchor = HtmlTree.SPAN_ID(
HtmlIds.forLine(currentLineNo),
Text.of(utils.replaceTabs(line)));
pre.add(anchor);
@ -324,7 +324,7 @@ public class SourceToHTMLConverter {
/**
* Add trailing blank lines at the end of the page.
*
* @param pre the content tree to which the blank lines will be added.
* @param pre the content to which the blank lines will be added.
*/
private static void addBlankLines(Content pre) {
for (int i = 0; i < NUM_BLANK_LINES; i++) {

View File

@ -71,10 +71,10 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* Add the summary header.
*
* @param mw the writer for the member being documented
* @param memberTree the content tree to which the summary header will be added
* @param memberContent the content to which the summary header will be added
*/
public void addSummaryHeader(AbstractMemberWriter mw, Content memberTree) {
mw.addSummaryLabel(memberTree);
public void addSummaryHeader(AbstractMemberWriter mw, Content memberContent) {
mw.addSummaryLabel(memberContent);
}
/**
@ -82,22 +82,22 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
*
* @param mw the writer for the member being documented
* @param typeElement the te to be documented
* @param inheritedTree the content tree to which the inherited summary header will be added
* @param inheritedContent the content to which the inherited summary header will be added
*/
public void addInheritedSummaryHeader(AbstractMemberWriter mw, TypeElement typeElement,
Content inheritedTree) {
mw.addInheritedSummaryLabel(typeElement, inheritedTree);
Content inheritedContent) {
mw.addInheritedSummaryLabel(typeElement, inheritedContent);
}
/**
* Add the index comment.
*
* @param member the member being documented
* @param contentTree the content tree to which the comment will be added
* @param content the content to which the comment will be added
*/
protected void addIndexComment(Element member, Content contentTree) {
protected void addIndexComment(Element member, Content content) {
List<? extends DocTree> tags = utils.getFirstSentenceTrees(member);
addIndexComment(member, tags, contentTree);
addIndexComment(member, tags, content);
}
/**
@ -105,41 +105,41 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
*
* @param member the member being documented
* @param firstSentenceTags the first sentence tags for the member to be documented
* @param tdSummary the content tree to which the comment will be added
* @param tdSummaryContent the content to which the comment will be added
*/
protected void addIndexComment(Element member, List<? extends DocTree> firstSentenceTags,
Content tdSummary) {
addPreviewSummary(member, tdSummary);
Content tdSummaryContent) {
addPreviewSummary(member, tdSummaryContent);
List<? extends DeprecatedTree> deprs = utils.getDeprecatedTrees(member);
Content div;
if (utils.isDeprecated(member)) {
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(member));
var deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(member));
div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
if (!deprs.isEmpty()) {
addSummaryDeprecatedComment(member, deprs.get(0), div);
}
tdSummary.add(div);
tdSummaryContent.add(div);
return;
} else {
Element te = member.getEnclosingElement();
if (te != null && utils.isTypeElement(te) && utils.isDeprecated(te)) {
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(te));
var deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(te));
div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
tdSummary.add(div);
tdSummaryContent.add(div);
}
}
addSummaryComment(member, firstSentenceTags, tdSummary);
addSummaryComment(member, firstSentenceTags, tdSummaryContent);
}
/**
* Add the summary link for the member.
*
* @param member the member to be documented
* @param contentTree the content tree to which the link will be added
* @param content the content to which the link will be added
*/
public void addSummaryLinkComment(Element member, Content contentTree) {
public void addSummaryLinkComment(Element member, Content content) {
List<? extends DocTree> tags = utils.getFirstSentenceTrees(member);
addSummaryLinkComment(member, tags, contentTree);
addSummaryLinkComment(member, tags, content);
}
/**
@ -147,10 +147,10 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
*
* @param member the member being documented
* @param firstSentenceTags the first sentence tags for the member to be documented
* @param tdSummary the content tree to which the comment will be added
* @param tdSummaryContent the content to which the comment will be added
*/
public void addSummaryLinkComment(Element member, List<? extends DocTree> firstSentenceTags, Content tdSummary) {
addIndexComment(member, firstSentenceTags, tdSummary);
public void addSummaryLinkComment(Element member, List<? extends DocTree> firstSentenceTags, Content tdSummaryContent) {
addIndexComment(member, firstSentenceTags, tdSummaryContent);
}
/**
@ -159,53 +159,49 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* @param mw the writer for the member being documented
* @param typeElement the class being documented
* @param member the member being documented
* @param isFirst true if its the first link being documented
* @param linksTree the content tree to which the summary will be added
* @param isFirst true if it is the first link being documented
* @param linksContent the content to which the summary will be added
*/
public void addInheritedMemberSummary(AbstractMemberWriter mw,
TypeElement typeElement,
Element member,
boolean isFirst,
Content linksTree) {
Content linksContent) {
if (!isFirst) {
linksTree.add(", ");
linksContent.add(", ");
}
mw.addInheritedSummaryLink(typeElement, member, linksTree);
mw.addInheritedSummaryLink(typeElement, member, linksContent);
}
/**
* Get the document content header tree
*
* @return a content tree the document content header
* {@return the document content header}
*/
public Content getContentHeader() {
return new ContentBuilder();
}
/**
* Add the class content tree.
* Add the class content.
*
* @param classContentTree class content tree which will be added to the content tree
* @param source class content which will be added to the documentation
*/
public void addClassContentTree(Content classContentTree) {
bodyContents.addMainContent(classContentTree);
public void addClassContent(Content source) {
bodyContents.addMainContent(source);
}
/**
* Add the annotation content tree.
* Add the annotation content.
*
* @param annotationContentTree annotation content tree which will be added to the content tree
* @param source annotation content which will be added to the documentation
*/
public void addAnnotationContentTree(Content annotationContentTree) {
addClassContentTree(annotationContentTree);
public void addAnnotationContent(Content source) {
addClassContent(source);
}
/**
* Get the member header tree
*
* @return a content tree for the member header
* {@return the member header}
*/
public Content getMemberTreeHeader() {
public Content getMemberHeader() {
return HtmlTree.UL(HtmlStyle.blockList);
}
@ -249,81 +245,75 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
}
/**
* Returns a list to be used for the list of members of a given kind.
*
* @return a list to be used for the list of members of a given kind
* {@return a list to add member items to}
*/
public Content getMemberList() {
return HtmlTree.UL(HtmlStyle.memberList);
}
/**
* Returns an item for the list of elements of a given kind
* {@return a member item}
*
* @param content content for the item
* @return an item for the list of elements of a given kind
* @param member the member to represent as an item
*/
public Content getMemberListItem(Content content) {
return HtmlTree.LI(content);
public Content getMemberListItem(Content member) {
return HtmlTree.LI(member);
}
public Content getMemberInheritedTree() {
public Content getMemberInherited() {
return HtmlTree.DIV(HtmlStyle.inheritedList);
}
/**
* Adds a section for a summary tree with the given CSS {@code class} and {@code id} attribute.
* Adds a section for a summary with the given CSS {@code class} and {@code id} attribute.
*
* @param style the CSS class for the section
* @param htmlId the id for the section
* @param summariesList the list of summary sections to which the summary will be added
* @param content the content tree representing the summary
* @param style the CSS class for the section
* @param htmlId the id for the section
* @param target the list of summary sections to which the summary will be added
* @param source the content representing the summary
*/
public void addSummary(HtmlStyle style, HtmlId htmlId, Content summariesList, Content content) {
HtmlTree htmlTree = HtmlTree.SECTION(style, content)
public void addSummary(HtmlStyle style, HtmlId htmlId, Content target, Content source) {
var htmlTree = HtmlTree.SECTION(style, source)
.setId(htmlId);
summariesList.add(getSummariesListItem(htmlTree));
target.add(getSummariesListItem(htmlTree));
}
/**
* Get the member tree
* {@return the member content}
*
* @param contentTree the tree used to generate the complete member tree
* @return a content tree for the member
* @param content the content used to generate the complete member
*/
public Content getMemberTree(Content contentTree) {
return HtmlTree.LI(contentTree);
public Content getMember(Content content) {
return HtmlTree.LI(content);
}
/**
* Get the member summary tree
* {@return the member summary content}
*
* @param contentTree the tree used to generate the member summary tree
* @return a content tree for the member summary
* @param memberContent the content used to generate the member summary
*/
public Content getMemberSummaryTree(Content contentTree) {
return HtmlTree.SECTION(HtmlStyle.summary, contentTree);
public Content getMemberSummary(Content memberContent) {
return HtmlTree.SECTION(HtmlStyle.summary, memberContent);
}
/**
* Get the member details tree
* {@return the member details}
*
* @param contentTree the tree used to generate the member details tree
* @return a content tree for the member details
* @param content the content used to generate the member details
*/
public Content getMemberDetailsTree(Content contentTree) {
return HtmlTree.SECTION(HtmlStyle.details, contentTree);
public Content getMemberDetailsContent(Content content) {
return HtmlTree.SECTION(HtmlStyle.details, content);
}
/**
* Get the member tree
* Get the member content
*
* @param id the id to be used for the content tree
* @param style the style class to be added to the content tree
* @param contentTree the tree used to generate the complete member tree
* @return the member tree
* @param id the id to be used for the content
* @param style the style class to be added to the content
* @param source the content used to generate the complete member content
* @return the member content
*/
public Content getMemberTree(HtmlId id, HtmlStyle style, Content contentTree) {
return HtmlTree.SECTION(style, contentTree).setId(id);
public Content getMember(HtmlId id, HtmlStyle style, Content source) {
return HtmlTree.SECTION(style, source).setId(id);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -146,28 +146,28 @@ public class SummaryListWriter<L extends SummaryAPIListBuilder> extends SubWrite
*
* @param id the id for the link
* @param headingKey
* @param contentTree the content tree to which the index link will be added
* @param content the content to which the index link will be added
*/
protected void addIndexLink(HtmlId id, String headingKey, Content contentTree) {
Content li = HtmlTree.LI(links.createLink(id,
protected void addIndexLink(HtmlId id, String headingKey, Content content) {
var li = HtmlTree.LI(links.createLink(id,
contents.getContent(headingKey)));
contentTree.add(li);
content.add(li);
}
/**
* Get the contents list.
*
* @param apiSummary the summary list builder
* @return a content tree for the contents list
* @return the contents list
*/
public Content getContentsList(L apiSummary) {
Content heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
var heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
var div = HtmlTree.DIV(HtmlStyle.header, heading);
Content headingContent = contents.contentsHeading;
div.add(HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
headingContent));
Content ul = new HtmlTree(TagName.UL);
var ul = new HtmlTree(TagName.UL);
addExtraIndexLink(apiSummary, ul);
for (SummaryElementKind kind : SummaryElementKind.values()) {
if (apiSummary.hasDocumentation(kind)) {
@ -179,29 +179,27 @@ public class SummaryListWriter<L extends SummaryAPIListBuilder> extends SubWrite
}
/**
* Get the header for the API Summary Listing.
*
* @return a content tree for the header
* {@return the header for the API Summary listing}
*/
public HtmlTree getHeader() {
String title = resources.getText(titleKey);
HtmlTree bodyTree = getBody(getWindowTitle(title));
HtmlTree body = getBody(getWindowTitle(title));
bodyContents.setHeader(getHeader(pageMode));
return bodyTree;
return body;
}
/**
* Add summary information to the documentation tree
* Add summary information to the documentation
*
* @param apiList list of API summary elements
* @param id the id attribute of the table
* @param headingKey the caption for the summary table
* @param headerKey table header key for the summary table
* @param contentTree the content tree to which the summary table will be added
* @param content the content to which the summary table will be added
*/
protected void addSummaryAPI(SortedSet<Element> apiList, HtmlId id,
String headingKey, String headerKey,
Content contentTree) {
Content content) {
if (apiList.size() > 0) {
TableHeader tableHeader = new TableHeader(
contents.getContent(headerKey), contents.descriptionLabel);
@ -231,7 +229,7 @@ public class SummaryListWriter<L extends SummaryAPIListBuilder> extends SubWrite
table.addRow(e, link, desc);
}
// note: singleton list
contentTree.add(HtmlTree.UL(HtmlStyle.blockList, HtmlTree.LI(table)));
content.add(HtmlTree.UL(HtmlStyle.blockList, HtmlTree.LI(table)));
}
}
@ -239,7 +237,7 @@ public class SummaryListWriter<L extends SummaryAPIListBuilder> extends SubWrite
* Add summary text for the given element.
*
* @param e the element for which the summary text should be added
* @param desc the target to which the text should be added
* @param desc the content to which the text should be added
*/
protected void addComments(Element e, Content desc) {
}
@ -264,7 +262,7 @@ public class SummaryListWriter<L extends SummaryAPIListBuilder> extends SubWrite
* Add an extra optional section to the content.
*
* @param list the element list
* @param target the target content to which the section should be added
* @param target the content to which the section should be added
*/
protected void addExtraSection(L list, Content target) {
}
@ -273,7 +271,7 @@ public class SummaryListWriter<L extends SummaryAPIListBuilder> extends SubWrite
* Add an extra optional index link.
*
* @param list the element list
* @param target the target content to which the link should be added
* @param target the content to which the link should be added
*/
protected void addExtraIndexLink(L list, Content target) {
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, 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
@ -119,11 +119,11 @@ public class SystemPropertiesWriter extends HtmlDocletWriter {
}
/**
* Adds all the system properties to the content tree.
* Adds all the system properties to the content.
*
* @param content HtmlTree content to which the links will be added
* @param target the content to which the links will be added
*/
protected void addSystemProperties(Content content) {
protected void addSystemProperties(Content target) {
Map<String, List<IndexItem>> searchIndexMap = groupSystemProperties();
Content separator = Text.of(", ");
Table table = new Table(HtmlStyle.summaryTable)
@ -141,7 +141,7 @@ public class SystemPropertiesWriter extends HtmlDocletWriter {
}
table.addRow(propertyName, HtmlTree.DIV(HtmlStyle.block, separatedReferenceLinks));
}
content.add(table);
target.add(table);
}
private Map<String, List<IndexItem>> groupSystemProperties() {

View File

@ -339,7 +339,7 @@ public class Table extends Content {
for (Content c : contents) {
HtmlStyle cellStyle = columnStyles.get(colIndex);
// Replace invalid content with HtmlTree.EMPTY to make sure the cell isn't dropped
HtmlTree cell = HtmlTree.DIV(cellStyle, c.isValid() ? c : HtmlTree.EMPTY);
var cell = HtmlTree.DIV(cellStyle, c.isValid() ? c : HtmlTree.EMPTY);
if (rowStyle != null) {
cell.addStyle(rowStyle);
}
@ -386,7 +386,7 @@ public class Table extends Content {
default -> throw new IllegalStateException();
};
HtmlTree table = HtmlTree.DIV(tableStyle).addStyle(columnStyle);
var table = HtmlTree.DIV(tableStyle).addStyle(columnStyle);
if ((tabMap == null || tabs.size() == 1) && !alwaysShowDefaultTab) {
if (tabMap == null) {
main.add(caption);
@ -396,7 +396,7 @@ public class Table extends Content {
table.add(getTableBody());
main.add(table);
} else {
HtmlTree tablist = HtmlTree.DIV(tabListStyle)
var tablist = HtmlTree.DIV(tabListStyle)
.put(HtmlAttr.ROLE, "tablist")
.put(HtmlAttr.ARIA_ORIENTATION, "horizontal");
@ -413,7 +413,7 @@ public class Table extends Content {
if (id == null) {
throw new IllegalStateException("no id set for table");
}
HtmlTree tabpanel = new HtmlTree(TagName.DIV)
var tabpanel = new HtmlTree(TagName.DIV)
.setId(HtmlIds.forTabPanel(id))
.put(HtmlAttr.ROLE, "tabpanel");
table.add(getTableBody());
@ -425,7 +425,7 @@ public class Table extends Content {
}
private HtmlTree createTab(HtmlId tabId, HtmlStyle style, boolean defaultTab, Content tabLabel) {
HtmlTree tab = new HtmlTree(TagName.BUTTON)
var tab = new HtmlTree(TagName.BUTTON)
.setId(tabId)
.put(HtmlAttr.ROLE, "tab")
.put(HtmlAttr.ARIA_SELECTED, defaultTab ? "true" : "false")

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2022, 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
@ -145,7 +145,7 @@ public class TableHeader extends Content {
: (i == 0) ? HtmlStyle.colFirst
: (i == (cellContents.size() - 1)) ? HtmlStyle.colLast
: (i == 1) ? HtmlStyle.colSecond : null;
HtmlTree cell = HtmlTree.DIV(HtmlStyle.tableHeader, cellContent);
var cell = HtmlTree.DIV(HtmlStyle.tableHeader, cellContent);
if (style != null) {
cell.addStyle(style);
}

View File

@ -202,8 +202,7 @@ public class TagletWriterImpl extends TagletWriter {
@Override
protected Content codeTagOutput(Element element, DocTree tag) {
CommentHelper ch = utils.getCommentHelper(element);
Content result = HtmlTree.CODE(Text.of(utils.normalizeNewlines(ch.getText(tag))));
return result;
return HtmlTree.CODE(Text.of(utils.normalizeNewlines(ch.getText(tag))));
}
@Override
@ -223,7 +222,7 @@ public class TagletWriterImpl extends TagletWriter {
}
// ugly but simple;
// alternatives would be to walk the Content tree, or to add new functionality to Content
// alternatives would be to walk the Content's tree structure, or to add new functionality to Content
private String extractText(Content c) {
return c.toString().replaceAll("<[^>]+>", "");
}
@ -301,8 +300,8 @@ public class TagletWriterImpl extends TagletWriter {
// define id attributes for state components so that generated descriptions may refer to them
boolean defineID = (element.getKind() == ElementKind.RECORD)
&& !paramTag.isTypeParameter();
Content nameTree = Text.of(paramName);
body.add(HtmlTree.CODE(defineID ? HtmlTree.SPAN_ID(HtmlIds.forParam(paramName), nameTree) : nameTree));
Content nameContent = Text.of(paramName);
body.add(HtmlTree.CODE(defineID ? HtmlTree.SPAN_ID(HtmlIds.forParam(paramName), nameContent) : nameContent));
body.add(" - ");
List<? extends DocTree> description = ch.getDescription(paramTag);
body.add(htmlWriter.commentTagsToContent(paramTag, element, description, context.within(paramTag)));
@ -353,7 +352,7 @@ public class TagletWriterImpl extends TagletWriter {
// Use a different style if any link label is longer than 30 chars or contains commas.
boolean hasLongLabels = links.stream()
.anyMatch(c -> c.charCount() > SEE_TAG_MAX_INLINE_LENGTH || c.toString().contains(","));
HtmlTree seeList = HtmlTree.UL(hasLongLabels ? HtmlStyle.seeListLong : HtmlStyle.seeList);
var seeList = HtmlTree.UL(hasLongLabels ? HtmlStyle.seeListLong : HtmlStyle.seeList);
links.stream().filter(Content::isValid).forEach(item -> {
seeList.add(HtmlTree.LI(item));
});
@ -384,11 +383,11 @@ public class TagletWriterImpl extends TagletWriter {
@Override
protected Content snippetTagOutput(Element element, SnippetTree tag, StyledText content,
String id, String lang) {
HtmlTree pre = new HtmlTree(TagName.PRE).setStyle(HtmlStyle.snippet);
var pre = new HtmlTree(TagName.PRE).setStyle(HtmlStyle.snippet);
if (id != null && !id.isBlank()) {
pre.put(HtmlAttr.ID, id);
}
HtmlTree code = new HtmlTree(TagName.CODE)
var code = new HtmlTree(TagName.CODE)
.add(HtmlTree.EMPTY); // Make sure the element is always rendered
if (lang != null && !lang.isBlank()) {
code.addStyle("language-" + lang);
@ -458,7 +457,7 @@ public class TagletWriterImpl extends TagletWriter {
});
String copyText = resources.getText("doclet.Copy_snippet_to_clipboard");
String copiedText = resources.getText("doclet.Copied_snippet_to_clipboard");
HtmlTree snippetContainer = HtmlTree.DIV(HtmlStyle.snippetContainer,
var snippetContainer = HtmlTree.DIV(HtmlStyle.snippetContainer,
new HtmlTree(TagName.BUTTON)
.add(HtmlTree.SPAN(Text.of(copyText))
.put(HtmlAttr.DATA_COPIED, copiedText))
@ -525,15 +524,13 @@ public class TagletWriterImpl extends TagletWriter {
body.add(" - ");
body.add(desc);
}
HtmlTree result = HtmlTree.DD(body);
return result;
return HtmlTree.DD(body);
}
@Override
public Content throwsTagOutput(TypeMirror throwsType) {
HtmlTree result = HtmlTree.DD(HtmlTree.CODE(htmlWriter.getLink(
return HtmlTree.DD(HtmlTree.CODE(htmlWriter.getLink(
new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.MEMBER, throwsType))));
return result;
}
@Override

View File

@ -101,11 +101,11 @@ public class TreeWriter extends AbstractTreeWriter {
* @throws DocFileIOException if there is a problem generating the overview tree page
*/
public void generateTreeFile() throws DocFileIOException {
HtmlTree body = getTreeHeader();
HtmlTree body = getBody();
Content headContent = contents.hierarchyForAllPackages;
Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
var heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
var div = HtmlTree.DIV(HtmlStyle.header, heading);
addPackageTreeLinks(div);
Content mainContent = new ContentBuilder();
mainContent.add(div);
@ -122,18 +122,18 @@ public class TreeWriter extends AbstractTreeWriter {
/**
* Add the links to all the package tree files.
*
* @param contentTree the content tree to which the links will be added
* @param content the content to which the links will be added
*/
protected void addPackageTreeLinks(Content contentTree) {
protected void addPackageTreeLinks(Content content) {
//Do nothing if only unnamed package is used
if (isUnnamedPackage()) {
return;
}
if (!classesOnly) {
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
var span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
contents.packageHierarchies);
contentTree.add(span);
HtmlTree ul = HtmlTree.UL(HtmlStyle.horizontal);
content.add(span);
var ul = HtmlTree.UL(HtmlStyle.horizontal);
int i = 0;
for (PackageElement pkg : packages) {
// If the package name length is 0 or if -nodeprecated option
@ -145,7 +145,7 @@ public class TreeWriter extends AbstractTreeWriter {
continue;
}
DocPath link = pathString(pkg, DocPaths.PACKAGE_TREE);
Content li = HtmlTree.LI(links.createLink(link,
var li = HtmlTree.LI(links.createLink(link,
getLocalizedPackageName(pkg)));
if (i < packages.size() - 1) {
li.add(", ");
@ -153,16 +153,14 @@ public class TreeWriter extends AbstractTreeWriter {
ul.add(li);
i++;
}
contentTree.add(ul);
content.add(ul);
}
}
/**
* Get the tree header.
*
* @return a content tree for the tree header
* {@return a new HTML BODY element}
*/
protected HtmlTree getTreeHeader() {
private HtmlTree getBody() {
String title = resources.getText("doclet.Window_Class_Hierarchy");
HtmlTree bodyTree = getBody(getWindowTitle(title));
bodyContents.setHeader(getHeader(PageMode.TREE));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, 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
@ -94,7 +94,7 @@ public class BodyContents extends Content {
HtmlTree flexHeader = header.addStyle(HtmlStyle.flexHeader);
HtmlTree flexContent = HtmlTree.DIV(HtmlStyle.flexContent)
var flexContent = HtmlTree.DIV(HtmlStyle.flexContent)
.add(HtmlTree.MAIN().add(mainContents))
.add(footer == null ? HtmlTree.EMPTY : footer);

View File

@ -269,45 +269,45 @@ public class Head extends Content {
* @return the HTML
*/
private Content toContent() {
HtmlTree tree = new HtmlTree(TagName.HEAD);
tree.add(getGeneratedBy(showTimestamp, generatedDate));
tree.add(HtmlTree.TITLE(title));
var head = new HtmlTree(TagName.HEAD);
head.add(getGeneratedBy(showTimestamp, generatedDate));
head.add(HtmlTree.TITLE(title));
tree.add(HtmlTree.META("viewport", "width=device-width, initial-scale=1"));
head.add(HtmlTree.META("viewport", "width=device-width, initial-scale=1"));
if (charset != null) { // compatibility; should this be allowed?
tree.add(HtmlTree.META("Content-Type", "text/html", charset));
head.add(HtmlTree.META("Content-Type", "text/html", charset));
}
if (showTimestamp) {
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
tree.add(HtmlTree.META("dc.created", generatedDate.format(dateFormat)));
head.add(HtmlTree.META("dc.created", generatedDate.format(dateFormat)));
}
if (description != null) {
tree.add(HtmlTree.META("description", description));
head.add(HtmlTree.META("description", description));
}
if (generator != null) {
tree.add(HtmlTree.META("generator", generator));
head.add(HtmlTree.META("generator", generator));
}
for (String k : keywords) {
tree.add(HtmlTree.META("keywords", k));
head.add(HtmlTree.META("keywords", k));
}
if (canonicalLink != null) {
HtmlTree link = new HtmlTree(TagName.LINK);
var link = new HtmlTree(TagName.LINK);
link.put(HtmlAttr.REL, "canonical");
link.put(HtmlAttr.HREF, canonicalLink.getPath());
tree.add(link);
head.add(link);
}
addStylesheets(tree);
addScripts(tree);
extraContent.forEach(tree::add);
addStylesheets(head);
addScripts(head);
extraContent.forEach(head::add);
return tree;
return head;
}
@ -322,31 +322,31 @@ public class Head extends Content {
return new Comment(text);
}
private void addStylesheets(HtmlTree tree) {
private void addStylesheets(HtmlTree head) {
if (mainStylesheet == null) {
mainStylesheet = DocPaths.STYLESHEET;
}
addStylesheet(tree, mainStylesheet);
addStylesheet(head, mainStylesheet);
for (DocPath path : additionalStylesheets) {
addStylesheet(tree, path);
addStylesheet(head, path);
}
if (index) {
// The order of the addStylesheet(...) calls is important
addStylesheet(tree, DocPaths.SCRIPT_DIR.resolve(DocPaths.JQUERY_UI_CSS));
addStylesheet(tree, DocPaths.JQUERY_OVERRIDES_CSS);
addStylesheet(head, DocPaths.SCRIPT_DIR.resolve(DocPaths.JQUERY_UI_CSS));
addStylesheet(head, DocPaths.JQUERY_OVERRIDES_CSS);
}
}
private void addStylesheet(HtmlTree tree, DocPath stylesheet) {
tree.add(HtmlTree.LINK("stylesheet", "text/css",
private void addStylesheet(HtmlTree head, DocPath stylesheet) {
head.add(HtmlTree.LINK("stylesheet", "text/css",
pathToRoot.resolve(stylesheet).getPath(), "Style"));
}
private void addScripts(HtmlTree tree) {
private void addScripts(HtmlTree head) {
if (addDefaultScript) {
tree.add(HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath()));
head.add(HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath()));
}
if (index) {
if (pathToRoot != null && mainBodyScript != null) {
@ -356,19 +356,19 @@ public class Head extends Content {
.append(";\n")
.append("loadScripts(document, 'script');");
}
addScriptElement(tree, DocPaths.JQUERY_JS);
addScriptElement(tree, DocPaths.JQUERY_UI_JS);
addScriptElement(head, DocPaths.JQUERY_JS);
addScriptElement(head, DocPaths.JQUERY_UI_JS);
}
for (DocPath path : additionalScripts) {
addScriptElement(tree, path);
addScriptElement(head, path);
}
for (Script script : scripts) {
tree.add(script.asContent());
head.add(script.asContent());
}
}
private void addScriptElement(HtmlTree tree, DocPath filePath) {
private void addScriptElement(HtmlTree head, DocPath filePath) {
DocPath scriptFile = pathToRoot.resolve(DocPaths.SCRIPT_DIR).resolve(filePath);
tree.add(HtmlTree.SCRIPT(scriptFile.getPath()));
head.add(HtmlTree.SCRIPT(scriptFile.getPath()));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, 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
@ -48,12 +48,12 @@ public class HtmlDocument {
private final Content docContent;
/**
* Constructor to construct an HTML document.
* Constructs an HTML document.
*
* @param htmlTree HTML tree of the document
* @param html the {@link TagName#HTML HTML} element of the document
*/
public HtmlDocument(Content htmlTree) {
docContent = htmlTree;
public HtmlDocument(Content html) {
docContent = html;
}
/**

View File

@ -905,7 +905,7 @@ public class HtmlTree extends Content {
*/
public static HtmlTree TITLE(String body) {
return new HtmlTree(TagName.TITLE)
.add(body);
.add(body);
}
/**
@ -928,18 +928,18 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree UL(HtmlStyle style, Content first, Content... more) {
HtmlTree htmlTree = new HtmlTree(TagName.UL)
var ul = new HtmlTree(TagName.UL)
.setStyle(style);
htmlTree.add(first);
ul.add(first);
for (Content c : more) {
htmlTree.add(c);
ul.add(c);
}
return htmlTree;
return ul;
}
/**
* Creates an HTML {@code UL} element with the given style and content generated
* from a collection of items..
* from a collection of items.
*
* @param style the style
* @param items the items to be added to the list

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@ -56,7 +56,7 @@ public class Links {
*
* @param id the position of the link in the file
* @param label the content for the link
* @return a content tree for the link
* @return the link
*/
public Content createLink(HtmlId id, Content label) {
DocLink l = DocLink.fragment(id.name());
@ -70,7 +70,7 @@ public class Links {
* @param id the position of the link in the file
* @param label the content for the link
* @param link whether to create a link or just return the label
* @return a content tree for the link or just the label
* @return the link or just the label
*/
public Content createLink(HtmlId id, Content label, boolean link) {
return link ? createLink(id, label) : label;
@ -83,7 +83,7 @@ public class Links {
* @param label the content for the link
* @param title the title for the link
*
* @return a content tree for the link
* @return the link
*/
public Content createLink(HtmlId id, Content label, String title) {
DocLink l = DocLink.fragment(id.name());
@ -95,7 +95,7 @@ public class Links {
*
* @param path the path for the link
* @param label the content for the link
* @return a content tree for the link
* @return the link
*/
public Content createLink(DocPath path, String label) {
return createLink(path, Text.of(label), null, "");
@ -106,7 +106,7 @@ public class Links {
*
* @param path the path for the link
* @param label the content for the link
* @return a content tree for the link
* @return the link
*/
public Content createLink(DocPath path, Content label) {
return createLink(path, label, "");
@ -120,7 +120,7 @@ public class Links {
* @param label the content for the link
* @param style the style for the link, or null
* @param title the title for the link
* @return a content tree for the link
* @return the link
*/
public Content createLink(DocPath path, Content label, HtmlStyle style, String title) {
return createLink(new DocLink(path), label, style, title);
@ -132,7 +132,7 @@ public class Links {
* @param path the path for the link
* @param label the content for the link
* @param title the title for the link
* @return a content tree for the link
* @return the link
*/
public Content createLink(DocPath path, Content label, String title) {
return createLink(new DocLink(path), label, title);
@ -143,7 +143,7 @@ public class Links {
*
* @param link the details for the link
* @param label the content for the link
* @return a content tree for the link
* @return the link
*/
public Content createLink(DocLink link, Content label) {
return createLink(link, label, "");
@ -155,10 +155,10 @@ public class Links {
* @param link the details for the link
* @param label the content for the link
* @param title the title for the link
* @return a content tree for the link
* @return the link
*/
public Content createLink(DocLink link, Content label, String title) {
HtmlTree anchor = HtmlTree.A(link.relativizeAgainst(file).toString(), label);
var anchor = HtmlTree.A(link.relativizeAgainst(file).toString(), label);
if (title != null && title.length() != 0) {
anchor.put(HtmlAttr.TITLE, title);
}
@ -173,7 +173,7 @@ public class Links {
* @param label the content for the link
* @param style the style for the link, or null
* @param title the title for the link
* @return a content tree for the link
* @return the link
*/
public Content createLink(DocLink link, Content label, HtmlStyle style,
String title) {
@ -189,11 +189,11 @@ public class Links {
* @param style the style for the link, or null
* @param title the title for the link
* @param isExternal is the link external to the generated documentation
* @return a content tree for the link
* @return the link
*/
public Content createLink(DocLink link, Content label, HtmlStyle style,
String title, boolean isExternal) {
HtmlTree l = HtmlTree.A(link.relativizeAgainst(file).toString(), label);
var l = HtmlTree.A(link.relativizeAgainst(file).toString(), label);
if (style != null) {
l.setStyle(style);
}
@ -212,7 +212,7 @@ public class Links {
*
* @param link the details for the link
* @param label the content for the link
* @return a content tree for the link
* @return the link
*/
public Content createExternalLink(DocLink link, Content label) {
return HtmlTree.A(link.relativizeAgainst(file).toString(), label)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -102,11 +102,11 @@ public class Script {
* Returns a "live" view of the script as a {@code Content} object.
* Any later modifications to the script will be reflected in the
* object that is returned.
* @return the script, as a {@code Content} object.
* @return the script
*/
public Content asContent() {
ScriptContent scriptContent = new ScriptContent(sb);
HtmlTree tree = new HtmlTree(TagName.SCRIPT) {
var script = new HtmlTree(TagName.SCRIPT) {
@Override
public HtmlTree add(Content c) {
if (c != scriptContent) {
@ -115,9 +115,9 @@ public class Script {
return super.add(scriptContent);
}
};
tree.put(HtmlAttr.TYPE, "text/javascript");
tree.add(scriptContent);
return tree;
script.put(HtmlAttr.TYPE, "text/javascript");
script.add(scriptContent);
return script;
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -39,48 +39,47 @@ import javax.lang.model.element.Element;
public interface AnnotationTypeMemberWriter extends MemberWriter {
/**
* Adds the annotation type member tree header.
* Adds the annotation type member header.
*
* @return content tree for the member tree header
* @return the content for the member header
*/
Content getMemberTreeHeader();
Content getMemberHeader();
/**
* Adds the annotation type details marker.
*
* @param memberDetails the content tree representing details marker
* @param memberDetails the content representing details marker
*/
void addAnnotationDetailsMarker(Content memberDetails);
/**
* Adds the annotation type details tree header.
* Adds the annotation type details header.
*
* @return content tree for the annotation details header
* @return the content for the annotation details header
*/
Content getAnnotationDetailsTreeHeader();
Content getAnnotationDetailsHeader();
/**
* Gets the annotation type documentation tree header.
* Gets the annotation type documentation header.
*
* @param member the annotation type being documented
* @return content tree for the annotation type documentation header
* @return the content for the annotation type documentation header
*/
Content getAnnotationDocTreeHeader(Element member);
Content getAnnotationHeaderContent(Element member);
/**
* Gets the annotation type details tree.
* Gets the annotation type details.
*
* @param annotationDetailsTreeHeader the content tree representing annotation type details header
* @param annotationDetailsTree the content tree representing annotation type details
* @return content tree for the annotation type details
* @param annotationDetailsHeader the content representing annotation type details header
* @param annotationDetails the content representing annotation type details
* @return the annotation type details
*/
Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree);
Content getAnnotationDetails(Content annotationDetailsHeader, Content annotationDetails);
/**
* Gets the signature for the given member.
* {@return the signature for the specified member}
*
* @param member the member being documented
* @return content tree for the annotation type signature
*/
Content getSignature(Element member);
@ -88,39 +87,39 @@ public interface AnnotationTypeMemberWriter extends MemberWriter {
* Adds the deprecated output for the given member.
*
* @param member the member being documented
* @param annotationDocTree content tree to which the deprecated information will be added
* @param target the content to which the deprecated information will be added
*/
void addDeprecated(Element member, Content annotationDocTree);
void addDeprecated(Element member, Content target);
/**
* Adds the preview output for the given member.
*
* @param member the member being documented
* @param contentTree content tree to which the preview information will be added
* @param content the content to which the preview information will be added
*/
void addPreview(Element member, Content contentTree);
void addPreview(Element member, Content content);
/**
* Adds the comments for the given member.
*
* @param member the member being documented
* @param annotationDocTree the content tree to which the comments will be added
* @param annotationContent the content to which the comments will be added
*/
void addComments(Element member, Content annotationDocTree);
void addComments(Element member, Content annotationContent);
/**
* Adds the tags for the given member.
*
* @param member the member being documented
* @param annotationDocTree the content tree to which the tags will be added
* @param annotationContent the content to which the tags will be added
*/
void addTags(Element member, Content annotationDocTree);
void addTags(Element member, Content annotationContent);
/**
* Adds the default value documentation if the member has one.
*
* @param member the member being documented
* @param annotationDocTree content tree to which the default value will be added
* @param annotationContent the content to which the default value will be added
*/
void addDefaultValueInfo(Element member, Content annotationDocTree);
void addDefaultValueInfo(Element member, Content annotationContent);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -56,119 +56,104 @@ public interface ClassWriter {
Content getClassContentHeader();
/**
* Add the class tree documentation.
* Add the class inheritance tree documentation.
*
* @param classContentTree class content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addClassTree(Content classContentTree);
/**
* Get the class information tree header.
*
* @return class information tree header that needs to be added to the documentation
*/
Content getClassInfoTreeHeader();
void addClassTree(Content target);
/**
* Add the type parameter and state component information.
*
* @param classInfoTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addParamInfo(Content classInfoTree);
void addParamInfo(Content target);
/**
* Add all super interfaces if this is an interface.
*
* @param classInfoTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addSuperInterfacesInfo(Content classInfoTree);
void addSuperInterfacesInfo(Content target);
/**
* Add all implemented interfaces if this is a class.
*
* @param classInfoTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addImplementedInterfacesInfo(Content classInfoTree);
void addImplementedInterfacesInfo(Content target);
/**
* Add all the classes that extend this one.
*
* @param classInfoTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addSubClassInfo(Content classInfoTree);
void addSubClassInfo(Content target);
/**
* Add all the interfaces that extend this one.
*
* @param classInfoTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addSubInterfacesInfo(Content classInfoTree);
void addSubInterfacesInfo(Content target);
/**
* If this is an interface, add all classes that implement this
* interface.
*
* @param classInfoTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addInterfaceUsageInfo(Content classInfoTree);
void addInterfaceUsageInfo(Content target);
/**
* If this is an functional interface, display appropriate message.
*
* @param classInfoTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addFunctionalInterfaceInfo(Content classInfoTree);
void addFunctionalInterfaceInfo(Content target);
/**
* If this is an inner class or interface, add the enclosing class or
* interface.
*
* @param classInfoTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
void addNestedClassInfo(Content classInfoTree);
void addNestedClassInfo(Content target);
/**
* Get the class information.
* {@return the class information}
*
* @param classInfoTree content tree containing the class information
* @return a content tree for the class
* @param classInfo the class information
*/
Content getClassInfo(Content classInfoTree);
Content getClassInfo(Content classInfo);
/**
* If this class is deprecated, add the appropriate information.
*
* @param classInfoTree content tree to which the documentation will be added
* @param classInfo the content to which the documentation will be added
*/
void addClassDeprecationInfo(Content classInfoTree);
void addClassDeprecationInfo(Content classInfo);
/**
* Add the signature of the current class content tree.
* Add the signature of the current class content.
*
* @param classInfoTree the class content tree to which the signature will be added
* @param classInfo the class content to which the signature will be added
*/
void addClassSignature(Content classInfoTree);
void addClassSignature(Content classInfo);
/**
* Build the class description.
*
* @param classInfoTree content tree to which the documentation will be added
* @param classInfo the content to which the documentation will be added
*/
void addClassDescription(Content classInfoTree);
void addClassDescription(Content classInfo);
/**
* Add the tag information for the current class.
*
* @param classInfoTree content tree to which the tag information will be added
* @param classInfo the content to which the tag information will be added
*/
void addClassTagInfo(Content classInfoTree);
/**
* Get the member tree header for the class.
*
* @return a content tree for the member tree header
*/
Content getMemberTreeHeader();
void addClassTagInfo(Content classInfo);
/**
* Returns a list to be used for the list of summaries for members of a given kind.
@ -201,11 +186,11 @@ public interface ClassWriter {
Content getDetailsListItem(Content content);
/**
* Add the class content tree.
* Add the class content.
*
* @param classContentTree class content tree which will be added to the content tree
* @param classContent the class content which will be added to the content
*/
void addClassContentTree(Content classContentTree);
void addClassContent(Content classContent);
/**
* Add the footer of the page.
@ -215,10 +200,10 @@ public interface ClassWriter {
/**
* Print the document.
*
* @param contentTree content tree that will be printed as a document
* @param content the content that will be printed as a document
* @throws DocFileIOException if there is a problem while writing the document
*/
void printDocument(Content contentTree) throws DocFileIOException;
void printDocument(Content content) throws DocFileIOException;
/**
* Return the TypeElement being documented.
@ -228,18 +213,16 @@ public interface ClassWriter {
TypeElement getTypeElement();
/**
* Get the member summary tree.
* {@return the member summary}
*
* @param memberTree the content tree used to build the summary tree
* @return a content tree for the member summary
* @param memberContent the content used to build the summary
*/
Content getMemberSummaryTree(Content memberTree);
Content getMemberSummary(Content memberContent);
/**
* Get the member details tree.
* {@return the member details}
*
* @param memberTree the content tree used to build the details tree
* @return a content tree for the member details
* @param memberContent the content used to generate the member details
*/
Content getMemberDetailsTree(Content memberTree);
Content getMemberDetails(Content memberContent);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022, 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
@ -504,26 +504,24 @@ public class CommentUtils {
}
/**
* Returns a list containing the string for a given key in the doclet's resources,
* formatted with given arguments.
* {@return a list containing the string for a given key in the doclet's
* resources, formatted with given arguments}
*
* @param key the key for the desired string
* @param o0 string or tree argument to be formatted into the result
* @return a content tree for the text
* @param o0 string or DocTree argument to be formatted into the result
*/
public List<? extends DocTree> getComment(String key, Object o0) {
return getComment(key, o0, null, null);
}
/**
* Returns a list containing the string for a given key in the doclet's resources,
* formatted with given arguments.
* {@return a list containing the string for a given key in the doclet's
* resources, formatted with given arguments}
*
* @param key the key for the desired string
* @param o0 string or tree argument to be formatted into the result
* @param o1 string or tree argument to be formatted into the result
* @param o2 string or tree argument to be formatted into the result
* @return a content tree for the text
* @param key the key for the desired strings
* @param o0 string or a DocTree argument to be formatted into the result
* @param o1 string or a DocTree argument to be formatted into the result
* @param o2 string or a DocTree argument to be formatted into the result
*/
public List<? extends DocTree> getComment(String key, Object o0, Object o1, Object o2) {
List<DocTree> l = new ArrayList<>();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -59,27 +59,27 @@ public interface ConstantsSummaryWriter {
Content getContentsHeader();
/**
* Adds the given package name link to the constant content list tree.
* Adds the given package name link to the constant content list.
*
* @param pkg the {@link PackageElement} to index.
* @param writtenPackageHeaders the set of package headers that have already
* been indexed, we want to index utmost once.
* @param contentListTree the content tree to which the link will be added
* @param content the content to which the link will be added
*/
void addLinkToPackageContent(PackageElement pkg, Set<PackageElement> writtenPackageHeaders,
Content contentListTree);
Content content);
/**
* Add the content list to the documentation tree.
* Add the content list to the documentation.
*
* @param contentListTree the content that will be added to the list
* @param content the content that will be added to the list
*/
void addContentsList(Content contentListTree);
void addContentsList(Content content);
/**
* Get the constant summaries for the document.
*
* @return constant summaries header to be added to the documentation tree
* @return constant summaries header to be added to the documentation
*/
Content getConstantSummaries();
@ -90,11 +90,11 @@ public interface ConstantsSummaryWriter {
* first 2 directory levels of the package
* name. For example, java.lang.ref would be
* indexed as java.lang.*.
* @param summariesTree the summaries documentation tree
* @param toContent the summaries documentation
* @param first true if the first package is listed
* be written
*/
void addPackageName(PackageElement pkg, Content summariesTree, boolean first);
void addPackageName(PackageElement pkg, Content toContent, boolean first);
/**
* Get the class summary header for the constants summary.
@ -104,30 +104,29 @@ public interface ConstantsSummaryWriter {
Content getClassConstantHeader();
/**
* Add the content list to the documentation summaries tree.
* Add the content list to the documentation summaries.
*
* @param summariesTree the tree to which the class constants list will be added
* @param classConstantTree the class constant tree that will be added to the list
* @param fromClassConstant the class constant content that will be added to the list
*/
void addClassConstant(Content summariesTree, Content classConstantTree);
void addClassConstant(Content fromClassConstant);
/**
* Adds the constant member table to the documentation tree.
* Adds the constant member table to the documentation.
*
* @param typeElement the class whose constants are being documented.
* @param fields the constants being documented.
* @param classConstantTree the documentation tree to which the constant member
* table content will be added
* @param target the content to which the constant member
* table content will be added
*/
void addConstantMembers(TypeElement typeElement, Collection<VariableElement> fields,
Content classConstantTree);
Content target);
/**
* Add the summaries list to the content tree.
* Add the summaries list to the content.
*
* @param summariesTree the summaries content tree that will be added to the list
* @param content the summaries content that will be added to the list
*/
void addConstantSummaries(Content summariesTree);
void addConstantSummaries(Content content);
/**
* Adds the footer for the summary documentation.
@ -137,8 +136,8 @@ public interface ConstantsSummaryWriter {
/**
* Print the constants summary document.
*
* @param contentTree content tree which should be printed
* @param content the content which should be printed
* @throws DocFileIOException if there is a problem while writing the document
*/
void printDocument(Content contentTree) throws DocFileIOException;
void printDocument(Content content) throws DocFileIOException;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -39,26 +39,23 @@ import javax.lang.model.element.ExecutableElement;
public interface ConstructorWriter extends MemberWriter {
/**
* Get the constructor details tree header.
* {@return the constructor details header}
*
* @param memberDetailsTree the content tree representing member details
* @return content tree for the constructor details header
* @param content the content representing member details
*/
Content getConstructorDetailsTreeHeader(Content memberDetailsTree);
Content getConstructorDetailsHeader(Content content);
/**
* Get the constructor documentation tree header.
* {@return the constructor documentation header}
*
* @param constructor the constructor being documented
* @return content tree for the constructor documentation header
*/
Content getConstructorDocTreeHeader(ExecutableElement constructor);
Content getConstructorHeaderContent(ExecutableElement constructor);
/**
* Get the signature for the given constructor.
* {@return the signature for the given constructor}
*
* @param constructor the constructor being documented
* @return content tree for the constructor signature
*/
Content getSignature(ExecutableElement constructor);
@ -66,42 +63,41 @@ public interface ConstructorWriter extends MemberWriter {
* Add the deprecated output for the given constructor.
*
* @param constructor the constructor being documented
* @param constructorDocTree content tree to which the deprecated information will be added
* @param constructorContent the content to which the deprecated information will be added
*/
void addDeprecated(ExecutableElement constructor, Content constructorDocTree);
void addDeprecated(ExecutableElement constructor, Content constructorContent);
/**
* Add the preview output for the given member.
*
* @param member the member being documented
* @param contentTree content tree to which the preview information will be added
* @param content the content to which the preview information will be added
*/
void addPreview(ExecutableElement member, Content contentTree);
void addPreview(ExecutableElement member, Content content);
/**
* Add the comments for the given constructor.
*
* @param constructor the constructor being documented
* @param constructorDocTree the content tree to which the comments will be added
* @param constructorContent the content to which the comments will be added
*/
void addComments(ExecutableElement constructor, Content constructorDocTree);
void addComments(ExecutableElement constructor, Content constructorContent);
/**
* Add the tags for the given constructor.
*
* @param constructor the constructor being documented
* @param constructorDocTree the content tree to which the tags will be added
* @param constructorContent the content to which the tags will be added
*/
void addTags(ExecutableElement constructor, Content constructorDocTree);
void addTags(ExecutableElement constructor, Content constructorContent);
/**
* Get the constructor details tree.
* {@return the constructor details}
*
* memberDetailsTreeHeader the content tree representing member details header
* @param memberDetailsTree the content tree representing member details
* @return content tree for the constructor details
* @param memberDetailsHeader the content representing member details header
* @param memberDetails the content representing member details
*/
Content getConstructorDetails(Content memberDetailsTreeHeader, Content memberDetailsTree);
Content getConstructorDetails(Content memberDetailsHeader, Content memberDetails);
/**
* Let the writer know whether a non public constructor was found.
@ -111,9 +107,7 @@ public interface ConstructorWriter extends MemberWriter {
void setFoundNonPubConstructor(boolean foundNonPubConstructor);
/**
* Gets the member header tree.
*
* @return a content tree for the member header
* @return the member header}
*/
Content getMemberTreeHeader();
Content getMemberHeader();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, 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
@ -32,7 +32,7 @@ import java.util.Collection;
import java.util.function.Function;
/**
* A class to create content for javadoc output pages.
* A content tree for javadoc output pages.
*
* <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.
@ -115,10 +115,10 @@ public abstract class Content {
*
* @param writer the writer
* @param atNewline whether the writer has just written a newline
* @return whether the writer has just written a newline
* @return whether the writer has just written a newline
* @throws IOException if an error occurs while writing the output
*/
public abstract boolean write(Writer writer, boolean atNewline) throws IOException ;
public abstract boolean write(Writer writer, boolean atNewline) throws IOException;
/**
* Returns true if the content is empty.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -40,30 +40,30 @@ import javax.lang.model.element.VariableElement;
public interface EnumConstantWriter extends MemberWriter {
/**
* Get the enum constants details tree header.
* Get the enum constants details header.
*
* @param typeElement the class being documented
* @param memberDetailsTree the content tree representing member details
* @return content tree for the enum constants details header
* @param memberDetails the content representing member details
* @return a content for the enum constants details header
*/
Content getEnumConstantsDetailsTreeHeader(TypeElement typeElement,
Content memberDetailsTree);
Content getEnumConstantsDetailsHeader(TypeElement typeElement,
Content memberDetails);
/**
* Get the enum constants documentation tree header.
* Get the enum constants documentation header.
*
* @param enumConstant the enum constant being documented
* @param enumConstantsDetailsTree the content tree representing enum constant details
* @return content tree for the enum constant documentation header
* @param enumConstantsDetails the content representing enum constant details
* @return the enum constant documentation header
*/
Content getEnumConstantsTreeHeader(VariableElement enumConstant,
Content enumConstantsDetailsTree);
Content getEnumConstantsHeader(VariableElement enumConstant,
Content enumConstantsDetails);
/**
* Get the signature for the given enum constant.
*
* @param enumConstant the enum constant being documented
* @return content tree for the enum constant signature
* @return the enum constant signature
*/
Content getSignature(VariableElement enumConstant);
@ -71,46 +71,47 @@ public interface EnumConstantWriter extends MemberWriter {
* Add the deprecated output for the given enum constant.
*
* @param enumConstant the enum constant being documented
* @param enumConstantsTree content tree to which the deprecated information will be added
* @param content the content to which the deprecated information will be added
*/
void addDeprecated(VariableElement enumConstant, Content enumConstantsTree);
void addDeprecated(VariableElement enumConstant, Content content);
/**
* Add the preview output for the given member.
*
* @param member the member being documented
* @param contentTree content tree to which the preview information will be added
* @param content the content to which the preview information will be added
*/
void addPreview(VariableElement member, Content contentTree);
void addPreview(VariableElement member, Content content);
/**
* Add the comments for the given enum constant.
*
* @param enumConstant the enum constant being documented
* @param enumConstantsTree the content tree to which the comments will be added
* @param enumConstants the content to which the comments will be added
*/
void addComments(VariableElement enumConstant, Content enumConstantsTree);
void addComments(VariableElement enumConstant, Content enumConstants);
/**
* Add the tags for the given enum constant.
*
* @param enumConstant the enum constant being documented
* @param enumConstantsTree the content tree to which the tags will be added
* @param content the content to which the tags will be added
*/
void addTags(VariableElement enumConstant, Content enumConstantsTree);
void addTags(VariableElement enumConstant, Content content);
/**
* Get the enum constants details tree.
* Get the enum constants details.
*
* @param memberDetailsTree the content tree representing member details
* @return content tree for the enum constant details
* @param memberDetailsHeader member details header
* @param content the content representing member details
* @return the enum constant details
*/
Content getEnumConstantsDetails(Content memberDetailsTreeHeader, Content memberDetailsTree);
Content getEnumConstantsDetails(Content memberDetailsHeader, Content content);
/**
* Gets the member header tree.
* Gets the member header.
*
* @return a content tree for the member header
* @return the member header
*/
Content getMemberTreeHeader();
Content getMemberHeader();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -40,26 +40,26 @@ import javax.lang.model.element.VariableElement;
public interface FieldWriter extends MemberWriter {
/**
* Get the field details tree header.
* Get the field details header.
*
* @param memberDetailsTree the content tree representing member details
* @return content tree for the field details header
* @param content the content representing member details
* @return the field details header
*/
Content getFieldDetailsTreeHeader(Content memberDetailsTree);
Content getFieldDetailsHeader(Content content);
/**
* Get the field documentation tree header.
* Get the field documentation header.
*
* @param field the constructor being documented
* @return content tree for the field documentation header
* @return the field documentation header
*/
Content getFieldDocTreeHeader(VariableElement field);
Content getFieldHeaderContent(VariableElement field);
/**
* Get the signature for the given field.
*
* @param field the field being documented
* @return content tree for the field signature
* @return the field signature
*/
Content getSignature(VariableElement field);
@ -67,47 +67,47 @@ public interface FieldWriter extends MemberWriter {
* Add the deprecated output for the given field.
*
* @param field the field being documented
* @param fieldDocTree content tree to which the deprecated information will be added
* @param fieldContent the content to which the deprecated information will be added
*/
void addDeprecated(VariableElement field, Content fieldDocTree);
void addDeprecated(VariableElement field, Content fieldContent);
/**
* Adds the preview output for the given member.
*
* @param member the member being documented
* @param contentTree content tree to which the preview information will be added
* @param content the content to which the preview information will be added
*/
void addPreview(VariableElement member, Content contentTree);
void addPreview(VariableElement member, Content content);
/**
* Add the comments for the given field.
*
* @param field the field being documented
* @param fieldDocTree the content tree to which the comments will be added
* @param fieldContent the content to which the comments will be added
*/
void addComments(VariableElement field, Content fieldDocTree);
void addComments(VariableElement field, Content fieldContent);
/**
* Add the tags for the given field.
*
* @param field the field being documented
* @param fieldDocTree the content tree to which the tags will be added
* @param fieldContent the content to which the tags will be added
*/
void addTags(VariableElement field, Content fieldDocTree);
void addTags(VariableElement field, Content fieldContent);
/**
* Get the field details tree.
* Get the field details.
*
* @param memberDetailsTreeHeader the content tree representing member details tree header
* @param memberDetailsTree the content tree representing member details
* @return content tree for the field details
* @param memberDetailsHeaderContent the content representing member details header
* @param memberContent the content representing member details
* @return the field details
*/
Content getFieldDetails(Content memberDetailsTreeHeader, Content memberDetailsTree);
Content getFieldDetails(Content memberDetailsHeaderContent, Content memberContent);
/**
* Gets the member header tree.
* Gets the member header.
*
* @return a content tree for the member header
* @return the member header
*/
Content getMemberTreeHeader();
Content getMemberHeader();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -46,21 +46,21 @@ public interface MemberSummaryWriter {
/**
* Returns the member summary header for the given class.
*
* @param typeElement the class the summary belongs to
* @param memberSummaryTree the content tree to which the member summary will be added
* @param typeElement the class the summary belongs to
* @param content the content to which the member summary will be added
*
* @return a content tree for the member summary header
* @return the member summary header
*/
Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree);
Content getMemberSummaryHeader(TypeElement typeElement, Content content);
/**
* Returns the summary table for the given class.
*
* @param typeElement the class the summary table belongs to
*
* @return a content tree for the member summary table
* @return the summary table
*/
Content getSummaryTableTree(TypeElement typeElement);
Content getSummaryTable(TypeElement typeElement);
/**
* Adds the member summary for the given class and member.
@ -77,7 +77,7 @@ public interface MemberSummaryWriter {
*
* @param typeElement the class the summary belongs to
*
* @return a content tree containing the inherited summary header
* @return the inherited member summary header
*/
Content getInheritedSummaryHeader(TypeElement typeElement);
@ -88,18 +88,18 @@ public interface MemberSummaryWriter {
* @param member the inherited member that is being documented
* @param isFirst true if this is the first member in the list
* @param isLast true if this is the last member in the list
* @param linksTree the content tree to which the links will be added
* @param content the content to which the links will be added
*/
void addInheritedMemberSummary(TypeElement typeElement,
Element member, boolean isFirst, boolean isLast,
Content linksTree);
Content content);
/**
* Returns the inherited summary links.
*
* @return a content tree containing the inherited summary links
* @return the inherited summary links
*/
Content getInheritedSummaryLinksTree();
Content getInheritedSummaryLinks();
/**
* Adds the given summary to the list of summaries.
@ -110,11 +110,11 @@ public interface MemberSummaryWriter {
void addSummary(Content summariesList, Content content);
/**
* Returns the member tree.
* Returns the member content.
*
* @param memberTree the content tree representing the member
* @param memberContent the content representing the member
*
* @return a content tree for the member
* @return the member content
*/
Content getMemberTree(Content memberTree);
Content getMember(Content memberContent);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, 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
@ -36,19 +36,17 @@ package jdk.javadoc.internal.doclets.toolkit;
public interface MemberWriter {
/**
* Returns a list to be used for the members of a given kind.
* {@return a list to add member items to}
*
* @return a list to be used for the members of a given kind
* @see #getMemberListItem(Content)
*/
Content getMemberList();
/**
* Returns an item for the list of elements of a given kind.
* {@return a member item}
*
* @param content the content tree of the member to be documented
* @return an item for the list of elements of a given kind
* @param member the member to represent as an item
* @see #getMemberList()
*/
Content getMemberListItem(Content content);
Content getMemberListItem(Content member);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -40,26 +40,26 @@ import javax.lang.model.type.TypeMirror;
public interface MethodWriter extends MemberWriter {
/**
* Get the method details tree header.
* Get the method details header.
*
* @param memberDetailsTree the content tree representing member details
* @return content tree for the method details header
* @param content the content representing member details
* @return the method details header
*/
Content getMethodDetailsTreeHeader(Content memberDetailsTree);
Content getMethodDetailsHeader(Content content);
/**
* Get the method documentation tree header.
* Get the method documentation header.
*
* @param method the method being documented
* @return content tree for the method documentation header
* @return the method documentation header
*/
Content getMethodDocTreeHeader(ExecutableElement method);
Content getMethodHeader(ExecutableElement method);
/**
* Get the signature for the given method.
*
* @param method the method being documented
* @return content tree for the method signature
* @return the method signature
*/
Content getSignature(ExecutableElement method);
@ -67,48 +67,48 @@ public interface MethodWriter extends MemberWriter {
* Add the deprecated output for the given method.
*
* @param method the method being documented
* @param methodDocTree content tree to which the deprecated information will be added
* @param methodContent the content to which the deprecated information will be added
*/
void addDeprecated(ExecutableElement method, Content methodDocTree);
void addDeprecated(ExecutableElement method, Content methodContent);
/**
* Adds the preview output for the given member.
*
* @param member the member being documented
* @param contentTree content tree to which the preview information will be added
* @param content the content to which the preview information will be added
*/
void addPreview(ExecutableElement member, Content contentTree);
void addPreview(ExecutableElement member, Content content);
/**
* Add the comments for the given method.
*
* @param holder the holder type (not erasure) of the method
* @param method the method being documented
* @param methodDocTree the content tree to which the comments will be added
* @param methodContent the content to which the comments will be added
*/
void addComments(TypeMirror holder, ExecutableElement method, Content methodDocTree);
void addComments(TypeMirror holder, ExecutableElement method, Content methodContent);
/**
* Add the tags for the given method.
*
* @param method the method being documented
* @param methodDocTree the content tree to which the tags will be added
* @param methodContent the content to which the tags will be added
*/
void addTags(ExecutableElement method, Content methodDocTree);
void addTags(ExecutableElement method, Content methodContent);
/**
* Get the method details tree.
* Get the method details.
*
* @param methodDetailsTreeHeader the content tree representing method details header
* @param methodDetailsTree the content tree representing method details
* @return content tree for the method details
* @param methodDetailsHeader the content representing method details header
* @param methodDetails the content representing method details
* @return the method details
*/
Content getMethodDetails(Content methodDetailsTreeHeader, Content methodDetailsTree);
Content getMethodDetails(Content methodDetailsHeader, Content methodDetails);
/**
* Gets the member header tree.
* Gets the member header.
*
* @return a content tree for the member header
* @return the member header
*/
Content getMemberTreeHeader();
Content getMemberHeader();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, 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
@ -42,47 +42,47 @@ public interface ModuleSummaryWriter {
* Get the header for the summary.
*
* @param heading module name.
* @return the header to be added to the content tree
* @return the header to be added to the content
*/
Content getModuleHeader(String heading);
/**
* Get the header for the module content.
*
* @return a content tree for the module content header
* @return the module content header
*/
Content getContentHeader();
/**
* Get the header for the summary header.
*
* @return a content tree with the summary header
* @return the summary header
*/
Content getSummariesList();
/**
* Get the header for the summary tree.
* Wrap the content into summary section.
*
* @param summaryContentTree the content tree.
* @return a content tree with the summary tree
* @param source the content to wrap into the summary section
* @return the summary
*/
Content getSummaryTree(Content summaryContentTree);
Content getSummary(Content source);
/**
* Adds the module description.
*
* @param moduleContentTree the content tree to which the module description
* will be added
* @param moduleContent the content to which the module description
* will be added
*/
void addModuleDescription(Content moduleContentTree);
void addModuleDescription(Content moduleContent);
/**
* Adds the module signature.
*
* @param moduleContentTree the content tree to which the module signature
* will be added
* @param moduleContent the content to which the module signature
* will be added
*/
void addModuleSignature(Content moduleContentTree);
void addModuleSignature(Content moduleContent);
/**
* Adds the summary of modules to the list of summaries.
@ -106,22 +106,22 @@ public interface ModuleSummaryWriter {
void addServicesSummary(Content summariesList);
/**
* Adds the module content tree to the documentation tree.
* Adds the module content to the documentation.
*
* @param moduleContentTree the content tree that will be added
* @param source the content that will be added
*/
void addModuleContent(Content moduleContentTree);
void addModuleContent(Content source);
/**
* Adds the footer to the documentation tree.
* Adds the footer to the documentation.
*/
void addModuleFooter();
/**
* Print the module summary document.
*
* @param contentTree the content tree that will be printed
* @param content the content that will be printed
* @throws DocFileIOException if there is a problem while writing the document
*/
void printDocument(Content contentTree) throws DocFileIOException;
void printDocument(Content content) throws DocFileIOException;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -47,89 +47,87 @@ public interface PackageSummaryWriter {
/**
* Get the header for the summary.
*
* @return the header to be added to the content tree
* @return the header to be added to the content
*/
Content getPackageHeader();
/**
* Get the header for the package content.
*
* @return a content tree for the package content header
* @return the package content header
*/
Content getContentHeader();
/**
* Get the header for the package summary.
*
* @return a content tree with the package summary header
* @return the package summary header
*/
Content getSummariesList();
/**
* Adds the table of related packages to the documentation tree.
* Adds the table of related packages to the documentation.
*
* @param summaryContentTree the content tree to which the summaries will be added
* @param summaryContent the content to which the summaries will be added
*/
void addRelatedPackagesSummary(Content summaryContentTree);
void addRelatedPackagesSummary(Content summaryContent);
/**
* Adds the table of all classes and interfaces to the documentation tree.
* Adds the table of all classes and interfaces to the documentation.
*
* @param summaryContentTree the content tree to which the summaries will be added
* @param summaryContent the content to which the summaries will be added
*/
void addAllClassesAndInterfacesSummary(Content summaryContentTree);
void addAllClassesAndInterfacesSummary(Content summaryContent);
/**
* Adds the package description from the "packages.html" file to the documentation
* tree.
* Adds the package description from the "packages.html" file to the documentation.
*
* @param packageContentTree the content tree to which the package description
* will be added
* @param packageContent the content to which the package description
* will be added
*/
void addPackageDescription(Content packageContentTree);
void addPackageDescription(Content packageContent);
/**
* Adds the tag information from the "packages.html" file to the documentation
* tree.
* Adds the tag information from the "packages.html" file to the documentation.
*
* @param packageContentTree the content tree to which the package tags will
* be added
* @param packageContent the content to which the package tags will
* be added
*/
void addPackageTags(Content packageContentTree);
void addPackageTags(Content packageContent);
/**
* Adds the package signature.
*
* @param packageContentTree the content tree to which the package signature
* will be added
* @param packageContent the content to which the package signature
* will be added
*/
void addPackageSignature(Content packageContentTree);
void addPackageSignature(Content packageContent);
/**
* Adds the tag information from the "packages.html" or "package-info.java" file to the
* documentation tree.
* documentation.
*
* @param packageContentTree the package content tree to be added
* @param packageContent the package content to be added
*/
void addPackageContent(Content packageContentTree);
void addPackageContent(Content packageContent);
/**
* Adds the footer to the documentation tree.
* Adds the footer to the documentation.
*/
void addPackageFooter();
/**
* Print the package summary document.
*
* @param contentTree the content tree that will be printed
* @param content the content that will be printed
* @throws DocFileIOException if there is a problem while writing the document
*/
void printDocument(Content contentTree) throws DocFileIOException;
void printDocument(Content content) throws DocFileIOException;
/**
* Gets the package summary tree.
* @param summaryContentTree the content tree representing the package summary
* @return a content tree for the package summary
* Gets the package summary.
* @param summaryContent the content representing the package summary
* @return the package summary
*/
Content getPackageSummary(Content summaryContentTree);
Content getPackageSummary(Content summaryContent);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -39,26 +39,26 @@ import javax.lang.model.element.ExecutableElement;
public interface PropertyWriter extends MemberWriter {
/**
* Get the property details tree header.
* Get the property details header.
*
* @param memberDetailsTree the content tree representing member details
* @return content tree for the property details header
* @param memberDetails the content representing member details
* @return the property details header
*/
Content getPropertyDetailsTreeHeader(Content memberDetailsTree);
Content getPropertyDetailsHeader(Content memberDetails);
/**
* Get the property documentation tree header.
* Get the property documentation header.
*
* @param property the property being documented
* @return content tree for the property documentation header
* @return the property documentation header
*/
Content getPropertyDocTreeHeader(ExecutableElement property);
Content getPropertyHeaderContent(ExecutableElement property);
/**
* Get the signature for the given property.
*
* @param property the property being documented
* @return content tree for the property signature
* @return the property signature
*/
Content getSignature(ExecutableElement property);
@ -66,47 +66,40 @@ public interface PropertyWriter extends MemberWriter {
* Add the deprecated output for the given property.
*
* @param property the property being documented
* @param propertyDocTree content tree to which the deprecated information will be added
* @param propertyContent content to which the deprecated information will be added
*/
void addDeprecated(ExecutableElement property, Content propertyDocTree);
void addDeprecated(ExecutableElement property, Content propertyContent);
/**
* Add the preview output for the given member.
*
* @param member the member being documented
* @param contentTree content tree to which the preview information will be added
* @param content the content to which the preview information will be added
*/
void addPreview(ExecutableElement member, Content contentTree);
void addPreview(ExecutableElement member, Content content);
/**
* Add the comments for the given property.
*
* @param property the property being documented
* @param propertyDocTree the content tree to which the comments will be added
* @param propertyContent the content to which the comments will be added
*/
void addComments(ExecutableElement property, Content propertyDocTree);
void addComments(ExecutableElement property, Content propertyContent);
/**
* Add the tags for the given property.
*
* @param property the property being documented
* @param propertyDocTree the content tree to which the tags will be added
* @param propertyContent the content to which the tags will be added
*/
void addTags(ExecutableElement property, Content propertyDocTree);
void addTags(ExecutableElement property, Content propertyContent);
/**
* Get the property details tree.
* Get the property details.
*
* @param memberDetailsTreeHeader the content tree representing member details header
* @param memberDetailsTree the content tree representing member details
* @return content tree for the property details
* @param memberDetailsHeader the content representing member details header
* @param memberDetails the content representing member details
* @return the property details
*/
Content getPropertyDetails(Content memberDetailsTreeHeader, Content memberDetailsTree);
/**
* Gets the member header tree.
*
* @return a content tree for the member header
*/
Content getMemberTreeHeader();
Content getPropertyDetails(Content memberDetailsHeader, Content memberDetails);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -49,59 +49,53 @@ public interface SerializedFormWriter {
* Get the header.
*
* @param header the header to write.
* @return the header content tree
* @return the header content
*/
Content getHeader(String header);
/**
* Get the serialized form summaries header.
*
* @return the serialized form summary header tree
* @return the serialized form summary header
*/
Content getSerializedSummariesHeader();
/**
* Get the package serialized form header.
*
* @return the package serialized form header tree
* @return the package serialized form header
*/
Content getPackageSerializedHeader();
/**
* Add the serialized tree per package to the serialized summaries tree.
* Add the serialized package to the serialized summaries.
*
* @param serializedSummariesTree the serialized tree to which the package serialized tree will be added
* @param packageSerializedTree the serialized tree per package that needs to be added
* @param serializedSummaries the serialized content to which the package serialized content will be added
* @param packageSerialized the serialized content per package that needs to be added
*/
void addPackageSerializedTree(Content serializedSummariesTree, Content packageSerializedTree);
void addPackageSerialized(Content serializedSummaries, Content packageSerialized);
/**
* Get the given package header.
* {@return a header for the given package}
*
* @param packageElement the package element to write
* @return a content tree for the package header
*/
Content getPackageHeader(PackageElement packageElement);
/**
* Get the serialized class header.
*
* @return a content tree for the serialized class header
* {@return the serialized class header}
*/
Content getClassSerializedHeader();
/**
* Get the heading for the serializable class.
* {@return the heading for the serializable class}
*
* @param typeElement the class being processed
* @return a content tree for the class heading
*/
Content getClassHeader(TypeElement typeElement);
/**
* Get the serial UID info header.
*
* @return a content tree for the serial uid info header
* {@return the serial UID info header}
*/
Content getSerialUIDInfoHeader();
@ -110,14 +104,12 @@ public interface SerializedFormWriter {
*
* @param header the header that will show up before the UID.
* @param serialUID the serial UID to print.
* @param serialUidTree the serial UID tree to which the content will be added.
* @param target the serial UID to which the content will be added.
*/
void addSerialUIDInfo(String header, String serialUID, Content serialUidTree);
void addSerialUIDInfo(String header, String serialUID, Content target);
/**
* Get the class serialize content header.
*
* @return a content tree for the class serialize content header
* {@return the serialized class header}
*/
Content getClassContentHeader();
@ -140,9 +132,9 @@ public interface SerializedFormWriter {
/**
* Add the serialized content to the body content.
*
* @param serializedTreeContent content for serialized data
* @param source content for serialized data
*/
void addSerializedContent(Content serializedTreeContent);
void addSerializedContent(Content source);
/**
* Add the footer.
@ -152,89 +144,86 @@ public interface SerializedFormWriter {
/**
* Print the serialized form document.
*
* @param serializedTree the content tree that will be printed
* @param source the content that will be printed
* @throws DocFileIOException if there is a problem while writing the document
*/
void printDocument(Content serializedTree) throws DocFileIOException;
void printDocument(Content source) throws DocFileIOException;
/**
* Gets the member tree.
* Gets the member.
*
* @param contentTree the tree used to generate the complete member tree
* @return a content tree for the member
* @param content the content used to generate the complete member
* @return the member
*/
Content getMemberTree(Content contentTree);
Content getMember(Content content);
/**
* Write the serialized form for a given field.
* A writer for the serialized form for a given field.
*/
interface SerialFieldWriter {
/**
* Get the serializable field header.
*
* @return serialized fields header content tree
* {@return the serializable field header}
*/
Content getSerializableFieldsHeader();
/**
* Get the field content header.
* {@return the field content header}
*
* @param isLastContent true if this is the last content to be documented
* @return fields header content tree
*/
Content getFieldsContentHeader(boolean isLastContent);
/**
* Get the fields content.
* {@return the fields}
*
* @param heading the heading to write.
* @param contentTree content tree to which the heading will be added
* @return serializable fields content tree
* @param content the content to be added
* @return serializable fields content
*/
Content getSerializableFields(String heading, Content contentTree);
Content getSerializableFields(String heading, Content content);
/**
* Adds the deprecated information for this member.
*
* @param field the field to document.
* @param contentTree content tree to which the deprecated information will be added
* @param content the content to which the deprecated information will be added
*/
void addMemberDeprecatedInfo(VariableElement field, Content contentTree);
void addMemberDeprecatedInfo(VariableElement field, Content content);
/**
* Adds the description text for this member.
*
* @param field the field to document
* @param contentTree content tree to which the member description will be added
* @param content the content to which the member description will be added
*/
void addMemberDescription(VariableElement field, Content contentTree);
void addMemberDescription(VariableElement field, Content content);
/**
* Adds the description text for this member represented by the tag.
*
* @param field the field to document
* @param serialFieldTag the field to document (represented by tag)
* @param contentTree content tree to which the member description will be added
* @param content the content to which the member description will be added
*/
void addMemberDescription(VariableElement field, DocTree serialFieldTag, Content contentTree);
void addMemberDescription(VariableElement field, DocTree serialFieldTag, Content content);
/**
* Adds the tag information for this member.
*
* @param field the field to document
* @param contentTree content tree to which the member tags will be added
* @param content the content to which the member tags will be added
*/
void addMemberTags(VariableElement field, Content contentTree);
void addMemberTags(VariableElement field, Content content);
/**
* Adds the member header.
*
* @param fieldType the type of the field
* @param fieldName the name of the field
* @param contentTree content tree to which the member header will be added
* @param content the content to which the member header will be added
*/
void addMemberHeader(TypeMirror fieldType, String fieldName, Content contentTree);
void addMemberHeader(TypeMirror fieldType, String fieldName, Content content);
/**
* Check to see if overview details should be printed. If
@ -254,34 +243,31 @@ public interface SerializedFormWriter {
interface SerialMethodWriter {
/**
* Get the serializable method header.
*
* @return serializable methods content tree
* {@return the header for serializable methods section}
*/
Content getSerializableMethodsHeader();
/**
* Get the method content header.
* {@return the header for serializable methods content section}
*
* @param isLastContent true if this is the last content to be documented
* @return methods content tree
* @param isLastContent true if the content being documented is the last content
*/
Content getMethodsContentHeader(boolean isLastContent);
/**
* Write the given heading.
* Gets the given heading.
*
* @param heading the heading to write
* @param serializableMethodTree content tree which will be added
* @return serializable methods content tree
* @param source the content which will be added
* @return a serializable methods content
*/
Content getSerializableMethods(String heading, Content serializableMethodTree);
Content getSerializableMethods(String heading, Content source);
/**
* Write a warning that no serializable methods exist.
* Gets a warning that no serializable methods exist.
*
* @param msg the warning to print
* @return no customization message tree
* @return a no customization message
*/
Content getNoCustomizationMsg(String msg);
@ -289,35 +275,35 @@ public interface SerializedFormWriter {
* Adds the header.
*
* @param member the member to write the header for
* @param methodsContentTree content tree to which the header will be added
* @param methodsContent the content to which the header will be added
*/
void addMemberHeader(ExecutableElement member, Content methodsContentTree);
void addMemberHeader(ExecutableElement member, Content methodsContent);
/**
* Adds the deprecated information for this member.
*
* @param member the member to write the deprecated information for
* @param methodsContentTree content tree to which the deprecated
* @param methodsContent the content to which the deprecated
* information will be added
*/
void addDeprecatedMemberInfo(ExecutableElement member, Content methodsContentTree);
void addDeprecatedMemberInfo(ExecutableElement member, Content methodsContent);
/**
* Adds the description for this member.
*
* @param member the member to write the information for
* @param methodsContentTree content tree to which the member
* @param methodsContent the content to which the member
* information will be added
*/
void addMemberDescription(ExecutableElement member, Content methodsContentTree);
void addMemberDescription(ExecutableElement member, Content methodsContent);
/**
* Adds the tag information for this member.
*
* @param member the member to write the tags information for
* @param methodsContentTree content tree to which the tags
* @param methodsContent the content to which the tags
* information will be added
*/
void addMemberTags(ExecutableElement member, Content methodsContentTree);
void addMemberTags(ExecutableElement member, Content methodsContent);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -73,13 +73,12 @@ public abstract class AbstractMemberBuilder extends AbstractBuilder {
}
/**
*
* Build the documentation.
*
* @param contentTree The content tree into which to add the documentation
* @throws DocletException if there is a problem building the documentation
* @param target the content into which to add the documentation
* @throws DocletException if there is a problem building the documentation
*/
public abstract void build(Content contentTree) throws DocletException;
public abstract void build(Content target) throws DocletException;
/**
* Returns true if this subbuilder has anything to document.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -106,100 +106,100 @@ public class AnnotationTypeMemberBuilder extends AbstractMemberBuilder {
}
@Override
public void build(Content contentTree) throws DocletException {
buildAnnotationTypeMember(contentTree);
public void build(Content target) throws DocletException {
buildAnnotationTypeMember(target);
}
/**
* Build the member documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if an error occurs
*/
protected void buildAnnotationTypeMember(Content detailsList)
protected void buildAnnotationTypeMember(Content target)
throws DocletException {
if (hasMembersToDocument()) {
writer.addAnnotationDetailsMarker(detailsList);
Content annotationDetailsTreeHeader = writer.getAnnotationDetailsTreeHeader();
writer.addAnnotationDetailsMarker(target);
Content annotationDetailsHeader = writer.getAnnotationDetailsHeader();
Content memberList = writer.getMemberList();
for (Element member : members) {
currentMember = member;
Content annotationDocTree = writer.getAnnotationDocTreeHeader(currentMember);
Content annotationContent = writer.getAnnotationHeaderContent(currentMember);
buildAnnotationTypeMemberChildren(annotationDocTree);
buildAnnotationTypeMemberChildren(annotationContent);
memberList.add(writer.getMemberListItem(annotationDocTree));
memberList.add(writer.getMemberListItem(annotationContent));
}
Content annotationDetails = writer.getAnnotationDetails(annotationDetailsTreeHeader, memberList);
detailsList.add(annotationDetails);
Content annotationDetails = writer.getAnnotationDetails(annotationDetailsHeader, memberList);
target.add(annotationDetails);
}
}
protected void buildAnnotationTypeMemberChildren(Content annotationDocTree) {
buildSignature(annotationDocTree);
buildDeprecationInfo(annotationDocTree);
buildPreviewInfo(annotationDocTree);
buildMemberComments(annotationDocTree);
buildTagInfo(annotationDocTree);
buildDefaultValueInfo(annotationDocTree);
protected void buildAnnotationTypeMemberChildren(Content annotationContent) {
buildSignature(annotationContent);
buildDeprecationInfo(annotationContent);
buildPreviewInfo(annotationContent);
buildMemberComments(annotationContent);
buildTagInfo(annotationContent);
buildDefaultValueInfo(annotationContent);
}
/**
* Build the signature.
*
* @param annotationDocTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildSignature(Content annotationDocTree) {
annotationDocTree.add(writer.getSignature(currentMember));
protected void buildSignature(Content target) {
target.add(writer.getSignature(currentMember));
}
/**
* Build the deprecation information.
*
* @param annotationDocTree the content tree to which the documentation will be added
* @param annotationContent the content to which the documentation will be added
*/
protected void buildDeprecationInfo(Content annotationDocTree) {
writer.addDeprecated(currentMember, annotationDocTree);
protected void buildDeprecationInfo(Content annotationContent) {
writer.addDeprecated(currentMember, annotationContent);
}
/**
* Build the preview information.
*
* @param annotationDocTree the content tree to which the documentation will be added
* @param annotationContent the content to which the documentation will be added
*/
protected void buildPreviewInfo(Content annotationDocTree) {
writer.addPreview(currentMember, annotationDocTree);
protected void buildPreviewInfo(Content annotationContent) {
writer.addPreview(currentMember, annotationContent);
}
/**
* Build the comments for the member. Do nothing if
* {@link BaseOptions#noComment()} is set to true.
*
* @param annotationDocTree the content tree to which the documentation will be added
* @param annotationContent the content to which the documentation will be added
*/
protected void buildMemberComments(Content annotationDocTree) {
protected void buildMemberComments(Content annotationContent) {
if (!options.noComment()) {
writer.addComments(currentMember, annotationDocTree);
writer.addComments(currentMember, annotationContent);
}
}
/**
* Build the tag information.
*
* @param annotationDocTree the content tree to which the documentation will be added
* @param annotationContent the content to which the documentation will be added
*/
protected void buildTagInfo(Content annotationDocTree) {
writer.addTags(currentMember, annotationDocTree);
protected void buildTagInfo(Content annotationContent) {
writer.addTags(currentMember, annotationContent);
}
/**
* Build the default value for this optional member.
*
* @param annotationDocTree the content tree to which the documentation will be added
* @param annotationContent the content to which the documentation will be added
*/
protected void buildDefaultValueInfo(Content annotationDocTree) {
writer.addDefaultValueInfo(currentMember, annotationDocTree);
protected void buildDefaultValueInfo(Content annotationContent) {
writer.addDefaultValueInfo(currentMember, annotationContent);
}
/**

View File

@ -66,11 +66,6 @@ public class ClassBuilder extends AbstractBuilder {
*/
private final ClassWriter writer;
/**
* The content tree for the class documentation.
*/
private Content contentTree;
private final Utils utils;
/**
@ -122,133 +117,133 @@ public class ClassBuilder extends AbstractBuilder {
case CLASS -> "doclet.Class";
default -> throw new IllegalStateException(typeElement.getKind() + " " + typeElement);
};
Content contentTree = writer.getHeader(resources.getText(key) + " "
Content content = writer.getHeader(resources.getText(key) + " "
+ utils.getSimpleName(typeElement));
Content classContentTree = writer.getClassContentHeader();
Content classContent = writer.getClassContentHeader();
buildClassTree(classContentTree);
buildClassInfo(classContentTree);
buildMemberSummary(classContentTree);
buildMemberDetails(classContentTree);
buildClassTree(classContent);
buildClassInfo(classContent);
buildMemberSummary(classContent);
buildMemberDetails(classContent);
writer.addClassContentTree(classContentTree);
writer.addClassContent(classContent);
writer.addFooter();
writer.printDocument(contentTree);
writer.printDocument(content);
copyDocFiles();
}
/**
* Build the class tree documentation.
* Build the class inheritance tree documentation.
*
* @param classContentTree the content tree to which the documentation will be added
* @param classContent the content to which the documentation will be added
*/
protected void buildClassTree(Content classContentTree) {
writer.addClassTree(classContentTree);
protected void buildClassTree(Content classContent) {
writer.addClassTree(classContent);
}
/**
* Build the class information tree documentation.
* Build the class information documentation.
*
* @param classContentTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildClassInfo(Content classContentTree) throws DocletException {
Content classInfoTree = new ContentBuilder();
buildParamInfo(classInfoTree);
buildSuperInterfacesInfo(classInfoTree);
buildImplementedInterfacesInfo(classInfoTree);
buildSubClassInfo(classInfoTree);
buildSubInterfacesInfo(classInfoTree);
buildInterfaceUsageInfo(classInfoTree);
buildNestedClassInfo(classInfoTree);
buildFunctionalInterfaceInfo(classInfoTree);
buildClassSignature(classInfoTree);
buildDeprecationInfo(classInfoTree);
buildClassDescription(classInfoTree);
buildClassTagInfo(classInfoTree);
protected void buildClassInfo(Content target) throws DocletException {
Content c = new ContentBuilder();
buildParamInfo(c);
buildSuperInterfacesInfo(c);
buildImplementedInterfacesInfo(c);
buildSubClassInfo(c);
buildSubInterfacesInfo(c);
buildInterfaceUsageInfo(c);
buildNestedClassInfo(c);
buildFunctionalInterfaceInfo(c);
buildClassSignature(c);
buildDeprecationInfo(c);
buildClassDescription(c);
buildClassTagInfo(c);
classContentTree.add(writer.getClassInfo(classInfoTree));
target.add(writer.getClassInfo(c));
}
/**
* Build the type parameters and state components of this class.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildParamInfo(Content classInfoTree) {
writer.addParamInfo(classInfoTree);
protected void buildParamInfo(Content target) {
writer.addParamInfo(target);
}
/**
* If this is an interface, list all super interfaces.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildSuperInterfacesInfo(Content classInfoTree) {
writer.addSuperInterfacesInfo(classInfoTree);
protected void buildSuperInterfacesInfo(Content target) {
writer.addSuperInterfacesInfo(target);
}
/**
* If this is a class, list all interfaces implemented by this class.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildImplementedInterfacesInfo(Content classInfoTree) {
writer.addImplementedInterfacesInfo(classInfoTree);
protected void buildImplementedInterfacesInfo(Content target) {
writer.addImplementedInterfacesInfo(target);
}
/**
* List all the classes extend this one.
* List all the classes that extend this one.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildSubClassInfo(Content classInfoTree) {
writer.addSubClassInfo(classInfoTree);
protected void buildSubClassInfo(Content target) {
writer.addSubClassInfo(target);
}
/**
* List all the interfaces that extend this one.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildSubInterfacesInfo(Content classInfoTree) {
writer.addSubInterfacesInfo(classInfoTree);
protected void buildSubInterfacesInfo(Content target) {
writer.addSubInterfacesInfo(target);
}
/**
* If this is an interface, list all classes that implement this interface.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildInterfaceUsageInfo(Content classInfoTree) {
writer.addInterfaceUsageInfo(classInfoTree);
protected void buildInterfaceUsageInfo(Content target) {
writer.addInterfaceUsageInfo(target);
}
/**
* If this is an functional interface, display appropriate message.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildFunctionalInterfaceInfo(Content classInfoTree) {
writer.addFunctionalInterfaceInfo(classInfoTree);
protected void buildFunctionalInterfaceInfo(Content target) {
writer.addFunctionalInterfaceInfo(target);
}
/**
* If this class is deprecated, build the appropriate information.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildDeprecationInfo(Content classInfoTree) {
writer.addClassDeprecationInfo(classInfoTree);
protected void buildDeprecationInfo(Content target) {
writer.addClassDeprecationInfo(target);
}
/**
* If this is an inner class or interface, list the enclosing class or interface.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildNestedClassInfo(Content classInfoTree) {
writer.addNestedClassInfo(classInfoTree);
protected void buildNestedClassInfo(Content target) {
writer.addNestedClassInfo(target);
}
/**
@ -275,49 +270,49 @@ public class ClassBuilder extends AbstractBuilder {
/**
* Build the signature of the current class.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildClassSignature(Content classInfoTree) {
writer.addClassSignature(classInfoTree);
protected void buildClassSignature(Content target) {
writer.addClassSignature(target);
}
/**
* Build the class description.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildClassDescription(Content classInfoTree) {
writer.addClassDescription(classInfoTree);
protected void buildClassDescription(Content target) {
writer.addClassDescription(target);
}
/**
* Build the tag information for the current class.
*
* @param classInfoTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildClassTagInfo(Content classInfoTree) {
writer.addClassTagInfo(classInfoTree);
protected void buildClassTagInfo(Content target) {
writer.addClassTagInfo(target);
}
/**
* Build the member summary contents of the page.
*
* @param classContentTree the content tree to which the documentation will be added
* @param classContent the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildMemberSummary(Content classContentTree) throws DocletException {
protected void buildMemberSummary(Content classContent) throws DocletException {
Content summariesList = writer.getSummariesList();
builderFactory.getMemberSummaryBuilder(writer).build(summariesList);
classContentTree.add(writer.getMemberSummaryTree(summariesList));
classContent.add(writer.getMemberSummary(summariesList));
}
/**
* Build the member details contents of the page.
*
* @param classContentTree the content tree to which the documentation will be added
* @param classContent the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildMemberDetails(Content classContentTree) throws DocletException {
protected void buildMemberDetails(Content classContent) throws DocletException {
Content detailsList = writer.getDetailsList();
buildEnumConstantsDetails(detailsList);
@ -327,13 +322,13 @@ public class ClassBuilder extends AbstractBuilder {
buildAnnotationTypeMemberDetails(detailsList);
buildMethodDetails(detailsList);
classContentTree.add(writer.getMemberDetailsTree(detailsList));
classContent.add(writer.getMemberDetails(detailsList));
}
/**
* Build the enum constants documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param detailsList the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildEnumConstantsDetails(Content detailsList) throws DocletException {
@ -343,7 +338,7 @@ public class ClassBuilder extends AbstractBuilder {
/**
* Build the field documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param detailsList the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildFieldDetails(Content detailsList) throws DocletException {
@ -353,7 +348,7 @@ public class ClassBuilder extends AbstractBuilder {
/**
* Build the property documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param detailsList the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
public void buildPropertyDetails( Content detailsList) throws DocletException {
@ -363,7 +358,7 @@ public class ClassBuilder extends AbstractBuilder {
/**
* Build the constructor documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param detailsList the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildConstructorDetails(Content detailsList) throws DocletException {
@ -373,7 +368,7 @@ public class ClassBuilder extends AbstractBuilder {
/**
* Build the method documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param detailsList the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildMethodDetails(Content detailsList) throws DocletException {
@ -383,12 +378,12 @@ public class ClassBuilder extends AbstractBuilder {
/**
* Build the annotation type optional member documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem building the documentation
*/
protected void buildAnnotationTypeMemberDetails(Content memberDetailsTree)
protected void buildAnnotationTypeMemberDetails(Content target)
throws DocletException {
builderFactory.getAnnotationTypeMemberBuilder(writer).build(memberDetailsTree);
builderFactory.getAnnotationTypeMemberBuilder(writer).build(target);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -127,27 +127,27 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildConstantSummary() throws DocletException {
Content contentTree = writer.getHeader();
Content content = writer.getHeader();
buildContents();
buildConstantSummaries();
writer.addFooter();
writer.printDocument(contentTree);
writer.printDocument(content);
}
/**
* Build the list of packages.
*/
protected void buildContents() {
Content contentListTree = writer.getContentsHeader();
Content contentList = writer.getContentsHeader();
printedPackageHeaders.clear();
for (PackageElement pkg : configuration.packages) {
if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg)) {
writer.addLinkToPackageContent(pkg, printedPackageHeaders, contentListTree);
writer.addLinkToPackageContent(pkg, printedPackageHeaders, contentList);
}
}
writer.addContentsList(contentListTree);
writer.addContentsList(contentList);
}
/**
@ -157,30 +157,30 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
*/
protected void buildConstantSummaries() throws DocletException {
printedPackageHeaders.clear();
Content summariesTree = writer.getConstantSummaries();
Content summaries = writer.getConstantSummaries();
for (PackageElement aPackage : configuration.packages) {
if (hasConstantField(aPackage)) {
currentPackage = aPackage;
//Build the documentation for the current package.
buildPackageHeader(summariesTree);
buildClassConstantSummary(summariesTree);
buildPackageHeader(summaries);
buildClassConstantSummary();
first = false;
}
}
writer.addConstantSummaries(summariesTree);
writer.addConstantSummaries(summaries);
}
/**
* Build the header for the given package.
*
* @param summariesTree the tree to which the package header will be added
* @param target the content to which the package header will be added
*/
protected void buildPackageHeader(Content summariesTree) {
protected void buildPackageHeader(Content target) {
PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(currentPackage);
if (!printedPackageHeaders.contains(abbrevPkg)) {
writer.addPackageName(currentPackage, summariesTree, first);
writer.addPackageName(currentPackage, target, first);
printedPackageHeaders.add(abbrevPkg);
}
}
@ -188,16 +188,14 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
/**
* Build the summary for the current class.
*
* @param summariesTree the tree to which the class constant summary will be added
* @throws DocletException if there is a problem while building the documentation
*
*/
protected void buildClassConstantSummary(Content summariesTree)
protected void buildClassConstantSummary()
throws DocletException {
SortedSet<TypeElement> classes = !currentPackage.isUnnamed()
? utils.getAllClasses(currentPackage)
: configuration.typeElementCatalog.allUnnamedClasses();
Content classConstantTree = writer.getClassConstantHeader();
Content classConstantHeader = writer.getClassConstantHeader();
for (TypeElement te : classes) {
if (!typeElementsWithConstFields.contains(te) ||
!utils.isIncluded(te)) {
@ -206,20 +204,20 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
currentClass = te;
//Build the documentation for the current class.
buildConstantMembers(classConstantTree);
buildConstantMembers(classConstantHeader);
}
writer.addClassConstant(summariesTree, classConstantTree);
writer.addClassConstant(classConstantHeader);
}
/**
* Build the summary of constant members in the class.
*
* @param classConstantTree the tree to which the constant members table
* will be added
* @param target the content to which the constant members table
* will be added
*/
protected void buildConstantMembers(Content classConstantTree) {
new ConstantFieldBuilder(currentClass).buildMembersSummary(classConstantTree);
protected void buildConstantMembers(Content target) {
new ConstantFieldBuilder(currentClass).buildMembersSummary(target);
}
/**
@ -296,13 +294,13 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
/**
* Builds the table of constants for a given class.
*
* @param classConstantTree the tree to which the class constants table
* will be added
* @param target the content to which the class constants table
* will be added
*/
protected void buildMembersSummary(Content classConstantTree) {
protected void buildMembersSummary(Content target) {
SortedSet<VariableElement> members = members();
if (!members.isEmpty()) {
writer.addConstantMembers(typeElement, members, classConstantTree);
writer.addConstantMembers(typeElement, members, target);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -111,83 +111,83 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
}
@Override
public void build(Content contentTree) throws DocletException {
buildConstructorDoc(contentTree);
public void build(Content target) throws DocletException {
buildConstructorDoc(target);
}
/**
* Build the constructor documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildConstructorDoc(Content detailsList) throws DocletException {
protected void buildConstructorDoc(Content target) throws DocletException {
if (hasMembersToDocument()) {
Content constructorDetailsTreeHeader = writer.getConstructorDetailsTreeHeader(detailsList);
Content constructorDetailsHeader = writer.getConstructorDetailsHeader(target);
Content memberList = writer.getMemberList();
for (Element constructor : constructors) {
currentConstructor = (ExecutableElement)constructor;
Content constructorDocTree = writer.getConstructorDocTreeHeader(currentConstructor);
Content constructorContent = writer.getConstructorHeaderContent(currentConstructor);
buildSignature(constructorDocTree);
buildDeprecationInfo(constructorDocTree);
buildPreviewInfo(constructorDocTree);
buildConstructorComments(constructorDocTree);
buildTagInfo(constructorDocTree);
buildSignature(constructorContent);
buildDeprecationInfo(constructorContent);
buildPreviewInfo(constructorContent);
buildConstructorComments(constructorContent);
buildTagInfo(constructorContent);
memberList.add(writer.getMemberListItem(constructorDocTree));
memberList.add(writer.getMemberListItem(constructorContent));
}
Content constructorDetails = writer.getConstructorDetails(constructorDetailsTreeHeader, memberList);
detailsList.add(constructorDetails);
Content constructorDetails = writer.getConstructorDetails(constructorDetailsHeader, memberList);
target.add(constructorDetails);
}
}
/**
* Build the signature.
*
* @param constructorDocTree the content tree to which the documentation will be added
* @param constructorContent the content to which the documentation will be added
*/
protected void buildSignature(Content constructorDocTree) {
constructorDocTree.add(writer.getSignature(currentConstructor));
protected void buildSignature(Content constructorContent) {
constructorContent.add(writer.getSignature(currentConstructor));
}
/**
* Build the deprecation information.
*
* @param constructorDocTree the content tree to which the documentation will be added
* @param constructorContent the content to which the documentation will be added
*/
protected void buildDeprecationInfo(Content constructorDocTree) {
writer.addDeprecated(currentConstructor, constructorDocTree);
protected void buildDeprecationInfo(Content constructorContent) {
writer.addDeprecated(currentConstructor, constructorContent);
}
/**
* Build the preview information.
*
* @param constructorDocTree the content tree to which the documentation will be added
* @param constructorContent the content to which the documentation will be added
*/
protected void buildPreviewInfo(Content constructorDocTree) {
writer.addPreview(currentConstructor, constructorDocTree);
protected void buildPreviewInfo(Content constructorContent) {
writer.addPreview(currentConstructor, constructorContent);
}
/**
* Build the comments for the constructor. Do nothing if
* {@link BaseOptions#noComment()} is set to true.
*
* @param constructorDocTree the content tree to which the documentation will be added
* @param constructorContent the content to which the documentation will be added
*/
protected void buildConstructorComments(Content constructorDocTree) {
protected void buildConstructorComments(Content constructorContent) {
if (!options.noComment()) {
writer.addComments(currentConstructor, constructorDocTree);
writer.addComments(currentConstructor, constructorContent);
}
}
/**
* Build the tag information.
*
* @param constructorDocTree the content tree to which the documentation will be added
* @param constructorContent the content to which the documentation will be added
*/
protected void buildTagInfo(Content constructorDocTree) {
writer.addTags(currentConstructor, constructorDocTree);
protected void buildTagInfo(Content constructorContent) {
writer.addTags(currentConstructor, constructorContent);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -102,87 +102,87 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
}
@Override
public void build(Content contentTree) throws DocletException {
buildEnumConstant(contentTree);
public void build(Content target) throws DocletException {
buildEnumConstant(target);
}
/**
* Build the enum constant documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException is there is a problem while building the documentation
*/
protected void buildEnumConstant(Content detailsList) throws DocletException {
protected void buildEnumConstant(Content target) throws DocletException {
if (hasMembersToDocument()) {
Content enumConstantsDetailsTreeHeader = writer.getEnumConstantsDetailsTreeHeader(typeElement,
detailsList);
Content enumConstantsDetailsHeader = writer.getEnumConstantsDetailsHeader(typeElement,
target);
Content memberList = writer.getMemberList();
for (Element enumConstant : enumConstants) {
currentElement = (VariableElement)enumConstant;
Content enumConstantsTree = writer.getEnumConstantsTreeHeader(currentElement,
Content enumConstants = writer.getEnumConstantsHeader(currentElement,
memberList);
buildSignature(enumConstantsTree);
buildDeprecationInfo(enumConstantsTree);
buildPreviewInfo(enumConstantsTree);
buildEnumConstantComments(enumConstantsTree);
buildTagInfo(enumConstantsTree);
buildSignature(enumConstants);
buildDeprecationInfo(enumConstants);
buildPreviewInfo(enumConstants);
buildEnumConstantComments(enumConstants);
buildTagInfo(enumConstants);
memberList.add(writer.getMemberListItem(enumConstantsTree));
memberList.add(writer.getMemberListItem(enumConstants));
}
Content enumConstantDetails = writer.getEnumConstantsDetails(
enumConstantsDetailsTreeHeader, memberList);
detailsList.add(enumConstantDetails);
enumConstantsDetailsHeader, memberList);
target.add(enumConstantDetails);
}
}
/**
* Build the signature.
*
* @param enumConstantsTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildSignature(Content enumConstantsTree) {
enumConstantsTree.add(writer.getSignature(currentElement));
protected void buildSignature(Content target) {
target.add(writer.getSignature(currentElement));
}
/**
* Build the deprecation information.
*
* @param enumConstantsTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildDeprecationInfo(Content enumConstantsTree) {
writer.addDeprecated(currentElement, enumConstantsTree);
protected void buildDeprecationInfo(Content target) {
writer.addDeprecated(currentElement, target);
}
/**
* Build the preview information.
*
* @param enumConstantsTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildPreviewInfo(Content enumConstantsTree) {
writer.addPreview(currentElement, enumConstantsTree);
protected void buildPreviewInfo(Content target) {
writer.addPreview(currentElement, target);
}
/**
* Build the comments for the enum constant. Do nothing if
* {@link BaseOptions#noComment()} is set to true.
*
* @param enumConstantsTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildEnumConstantComments(Content enumConstantsTree) {
protected void buildEnumConstantComments(Content target) {
if (!options.noComment()) {
writer.addComments(currentElement, enumConstantsTree);
writer.addComments(currentElement, target);
}
}
/**
* Build the tag information.
*
* @param enumConstantsTree the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildTagInfo(Content enumConstantsTree) {
writer.addTags(currentElement, enumConstantsTree);
protected void buildTagInfo(Content target) {
writer.addTags(currentElement, target);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -104,84 +104,84 @@ public class FieldBuilder extends AbstractMemberBuilder {
}
@Override
public void build(Content contentTree) throws DocletException {
buildFieldDoc(contentTree);
public void build(Content target) throws DocletException {
buildFieldDoc(target);
}
/**
* Build the field documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildFieldDoc(Content detailsList) throws DocletException {
protected void buildFieldDoc(Content target) throws DocletException {
if (!fields.isEmpty()) {
Content fieldDetailsTreeHeader = writer.getFieldDetailsTreeHeader(detailsList);
Content fieldDetailsHeader = writer.getFieldDetailsHeader(target);
Content memberList = writer.getMemberList();
for (Element element : fields) {
currentElement = (VariableElement)element;
Content fieldDocTree = writer.getFieldDocTreeHeader(currentElement);
Content fieldContent = writer.getFieldHeaderContent(currentElement);
buildSignature(fieldDocTree);
buildDeprecationInfo(fieldDocTree);
buildPreviewInfo(fieldDocTree);
buildFieldComments(fieldDocTree);
buildTagInfo(fieldDocTree);
buildSignature(fieldContent);
buildDeprecationInfo(fieldContent);
buildPreviewInfo(fieldContent);
buildFieldComments(fieldContent);
buildTagInfo(fieldContent);
memberList.add(writer.getMemberListItem(fieldDocTree));
memberList.add(writer.getMemberListItem(fieldContent));
}
Content fieldDetails = writer.getFieldDetails(fieldDetailsTreeHeader, memberList);
detailsList.add(fieldDetails);
Content fieldDetails = writer.getFieldDetails(fieldDetailsHeader, memberList);
target.add(fieldDetails);
}
}
/**
* Build the signature.
*
* @param fieldDocTree the content tree to which the documentation will be added
* @param fieldContent the content to which the documentation will be added
*/
protected void buildSignature(Content fieldDocTree) {
fieldDocTree.add(writer.getSignature(currentElement));
protected void buildSignature(Content fieldContent) {
fieldContent.add(writer.getSignature(currentElement));
}
/**
* Build the deprecation information.
*
* @param fieldDocTree the content tree to which the documentation will be added
* @param fieldContent the content to which the documentation will be added
*/
protected void buildDeprecationInfo(Content fieldDocTree) {
writer.addDeprecated(currentElement, fieldDocTree);
protected void buildDeprecationInfo(Content fieldContent) {
writer.addDeprecated(currentElement, fieldContent);
}
/**
* Build the preview information.
*
* @param fieldDocTree the content tree to which the documentation will be added
* @param fieldContent the content to which the documentation will be added
*/
protected void buildPreviewInfo(Content fieldDocTree) {
writer.addPreview(currentElement, fieldDocTree);
protected void buildPreviewInfo(Content fieldContent) {
writer.addPreview(currentElement, fieldContent);
}
/**
* Build the comments for the field. Do nothing if
* {@link BaseOptions#noComment()} is set to true.
*
* @param fieldDocTree the content tree to which the documentation will be added
* @param fieldContent the content to which the documentation will be added
*/
protected void buildFieldComments(Content fieldDocTree) {
protected void buildFieldComments(Content fieldContent) {
if (!options.noComment()) {
writer.addComments(currentElement, fieldDocTree);
writer.addComments(currentElement, fieldContent);
}
}
/**
* Build the tag information.
*
* @param fieldDocTree the content tree to which the documentation will be added
* @param fieldContent the content to which the documentation will be added
*/
protected void buildTagInfo(Content fieldDocTree) {
writer.addTags(currentElement, fieldDocTree);
protected void buildTagInfo(Content fieldContent) {
writer.addTags(currentElement, fieldContent);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -49,7 +49,6 @@ import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
@ -106,15 +105,15 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
ClassWriter classWriter, Context context) {
MemberSummaryBuilder builder = new MemberSummaryBuilder(context, classWriter.getTypeElement()) {
@Override
public void build(Content summariesList) {
buildPropertiesSummary(summariesList);
buildNestedClassesSummary(summariesList);
buildEnumConstantsSummary(summariesList);
buildAnnotationTypeRequiredMemberSummary(summariesList);
buildAnnotationTypeOptionalMemberSummary(summariesList);
buildFieldsSummary(summariesList);
buildConstructorsSummary(summariesList);
buildMethodsSummary(summariesList);
public void build(Content target) {
buildPropertiesSummary(target);
buildNestedClassesSummary(target);
buildEnumConstantsSummary(target);
buildAnnotationTypeRequiredMemberSummary(target);
buildAnnotationTypeOptionalMemberSummary(target);
buildFieldsSummary(target);
buildConstructorsSummary(target);
buildMethodsSummary(target);
}
@Override
@ -233,7 +232,7 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
/**
* Builds the summary for any methods.
*
* @param summariesList the content tree to which the documentation will be added
* @param summariesList the content to which the documentation will be added
*/
protected void buildMethodsSummary(Content summariesList) {
MemberSummaryWriter writer = memberSummaryWriters.get(METHODS);
@ -243,7 +242,7 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
/**
* Builds the summary for any constructors.
*
* @param summariesList the content tree to which the documentation will be added
* @param summariesList the content to which the documentation will be added
*/
protected void buildConstructorsSummary(Content summariesList) {
MemberSummaryWriter writer = memberSummaryWriters.get(CONSTRUCTORS);
@ -255,7 +254,7 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
*
* @param writer the summary writer to write the output.
* @param kind the kind of members to summarize.
* @param summaryTreeList list of content trees to which the documentation will be added
* @param summaryTreeList the list of contents to which the documentation will be added
*/
private void buildSummary(MemberSummaryWriter writer,
VisibleMemberTable.Kind kind, LinkedList<Content> summaryTreeList) {
@ -280,7 +279,7 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
}
writer.addMemberSummary(typeElement, member, firstSentenceTags);
}
summaryTreeList.add(writer.getSummaryTableTree(typeElement));
summaryTreeList.add(writer.getSummaryTable(typeElement));
}
}
@ -289,10 +288,10 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
*
* @param writer the writer for this member summary.
* @param kind the kind of members to document.
* @param summaryTreeList list of content trees to which the documentation will be added
* @param targets the list of contents to which the documentation will be added
*/
private void buildInheritedSummary(MemberSummaryWriter writer,
VisibleMemberTable.Kind kind, LinkedList<Content> summaryTreeList) {
VisibleMemberTable.Kind kind, LinkedList<Content> targets) {
VisibleMemberTable visibleMemberTable = getVisibleMemberTable();
SortedSet<? extends Element> inheritedMembersFromMap = asSortedSet(visibleMemberTable.getAllVisibleMembers(kind));
@ -314,22 +313,22 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
if (!members.isEmpty()) {
SortedSet<Element> inheritedMembers = new TreeSet<>(comparator);
inheritedMembers.addAll(members);
Content inheritedTree = writer.getInheritedSummaryHeader(inheritedClass);
Content linksTree = writer.getInheritedSummaryLinksTree();
addSummaryFootNote(inheritedClass, inheritedMembers, linksTree, writer);
inheritedTree.add(linksTree);
summaryTreeList.add(inheritedTree);
Content inheritedHeader = writer.getInheritedSummaryHeader(inheritedClass);
Content links = writer.getInheritedSummaryLinks();
addSummaryFootNote(inheritedClass, inheritedMembers, links, writer);
inheritedHeader.add(links);
targets.add(inheritedHeader);
}
}
}
private void addSummaryFootNote(TypeElement inheritedClass, SortedSet<Element> inheritedMembers,
Content linksTree, MemberSummaryWriter writer) {
Content links, MemberSummaryWriter writer) {
for (Element member : inheritedMembers) {
TypeElement t = utils.isUndocumentedEnclosure(inheritedClass)
? typeElement : inheritedClass;
writer.addInheritedMemberSummary(t, member, inheritedMembers.first() == member,
inheritedMembers.last() == member, linksTree);
inheritedMembers.last() == member, links);
}
}
@ -351,9 +350,9 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
if (showInheritedSummary)
buildInheritedSummary(writer, kind, summaryTreeList);
if (!summaryTreeList.isEmpty()) {
Content memberTree = writer.getMemberSummaryHeader(typeElement, summariesList);
summaryTreeList.forEach(memberTree::add);
writer.addSummary(summariesList, memberTree);
Content member = writer.getMemberSummaryHeader(typeElement, summariesList);
summaryTreeList.forEach(member::add);
writer.addSummary(summariesList, member);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -102,34 +102,34 @@ public class MethodBuilder extends AbstractMemberBuilder {
}
@Override
public void build(Content contentTree) throws DocletException {
buildMethodDoc(contentTree);
public void build(Content target) throws DocletException {
buildMethodDoc(target);
}
/**
* Build the method documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param detailsList the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildMethodDoc(Content detailsList) throws DocletException {
if (hasMembersToDocument()) {
Content methodDetailsTreeHeader = writer.getMethodDetailsTreeHeader(detailsList);
Content methodDetailsHeader = writer.getMethodDetailsHeader(detailsList);
Content memberList = writer.getMemberList();
for (Element method : methods) {
currentMethod = (ExecutableElement)method;
Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod);
Content methodContent = writer.getMethodHeader(currentMethod);
buildSignature(methodDocTree);
buildDeprecationInfo(methodDocTree);
buildPreviewInfo(methodDocTree);
buildMethodComments(methodDocTree);
buildTagInfo(methodDocTree);
buildSignature(methodContent);
buildDeprecationInfo(methodContent);
buildPreviewInfo(methodContent);
buildMethodComments(methodContent);
buildTagInfo(methodContent);
memberList.add(writer.getMemberListItem(methodDocTree));
memberList.add(writer.getMemberListItem(methodContent));
}
Content methodDetails = writer.getMethodDetails(methodDetailsTreeHeader, memberList);
Content methodDetails = writer.getMethodDetails(methodDetailsHeader, memberList);
detailsList.add(methodDetails);
}
}
@ -137,37 +137,37 @@ public class MethodBuilder extends AbstractMemberBuilder {
/**
* Build the signature.
*
* @param methodDocTree the content tree to which the documentation will be added
* @param methodContent the content to which the documentation will be added
*/
protected void buildSignature(Content methodDocTree) {
methodDocTree.add(writer.getSignature(currentMethod));
protected void buildSignature(Content methodContent) {
methodContent.add(writer.getSignature(currentMethod));
}
/**
* Build the deprecation information.
*
* @param methodDocTree the content tree to which the documentation will be added
* @param methodContent the content to which the documentation will be added
*/
protected void buildDeprecationInfo(Content methodDocTree) {
writer.addDeprecated(currentMethod, methodDocTree);
protected void buildDeprecationInfo(Content methodContent) {
writer.addDeprecated(currentMethod, methodContent);
}
/**
* Build the preview information.
*
* @param methodDocTree the content tree to which the documentation will be added
* @param methodContent the content to which the documentation will be added
*/
protected void buildPreviewInfo(Content methodDocTree) {
writer.addPreview(currentMethod, methodDocTree);
protected void buildPreviewInfo(Content methodContent) {
writer.addPreview(currentMethod, methodContent);
}
/**
* Build the comments for the method. Do nothing if
* {@link BaseOptions#noComment()} is set to true.
*
* @param methodDocTree the content tree to which the documentation will be added
* @param methodContent the content to which the documentation will be added
*/
protected void buildMethodComments(Content methodDocTree) {
protected void buildMethodComments(Content methodContent) {
if (!options.noComment()) {
ExecutableElement method = currentMethod;
if (utils.getFullBody(currentMethod).isEmpty()) {
@ -177,17 +177,17 @@ public class MethodBuilder extends AbstractMemberBuilder {
method = (ExecutableElement)docs.holder;
}
TypeMirror containingType = method.getEnclosingElement().asType();
writer.addComments(containingType, method, methodDocTree);
writer.addComments(containingType, method, methodContent);
}
}
/**
* Build the tag information.
*
* @param methodDocTree the content tree to which the documentation will be added
* @param methodContent the content to which the documentation will be added
*/
protected void buildTagInfo(Content methodDocTree) {
writer.addTags(currentMethod, methodDocTree);
protected void buildTagInfo(Content methodContent) {
writer.addTags(currentMethod, methodContent);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, 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
@ -103,12 +103,12 @@ public class ModuleSummaryBuilder extends AbstractBuilder {
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildModuleDoc() throws DocletException {
Content contentTree = moduleWriter.getModuleHeader(mdle.getQualifiedName().toString());
Content content = moduleWriter.getModuleHeader(mdle.getQualifiedName().toString());
buildContent();
moduleWriter.addModuleFooter();
moduleWriter.printDocument(contentTree);
moduleWriter.printDocument(content);
DocFilesHandler docFilesHandler = configuration.getWriterFactory().getDocFilesHandler(mdle);
docFilesHandler.copyDocFiles();
}
@ -119,30 +119,30 @@ public class ModuleSummaryBuilder extends AbstractBuilder {
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildContent() throws DocletException {
Content moduleContentTree = moduleWriter.getContentHeader();
Content moduleContent = moduleWriter.getContentHeader();
moduleWriter.addModuleSignature(moduleContentTree);
buildModuleDescription(moduleContentTree);
buildSummary(moduleContentTree);
moduleWriter.addModuleSignature(moduleContent);
buildModuleDescription(moduleContent);
buildSummary(moduleContent);
moduleWriter.addModuleContent(moduleContentTree);
moduleWriter.addModuleContent(moduleContent);
}
/**
* Builds the list of summary sections for this module.
*
* @param moduleContentTree the module content tree to which the summaries will
* be added
* @param target the module content to which the summaries will
* be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildSummary(Content moduleContentTree) throws DocletException {
protected void buildSummary(Content target) throws DocletException {
Content summariesList = moduleWriter.getSummariesList();
buildPackagesSummary(summariesList);
buildModulesSummary(summariesList);
buildServicesSummary(summariesList);
moduleContentTree.add(moduleWriter.getSummaryTree(summariesList));
target.add(moduleWriter.getSummary(summariesList));
}
/**
@ -175,12 +175,12 @@ public class ModuleSummaryBuilder extends AbstractBuilder {
/**
* Builds the description for this module.
*
* @param moduleContentTree the tree to which the module description will
* be added
* @param moduleContent the content to which the module description will
* be added
*/
protected void buildModuleDescription(Content moduleContentTree) {
protected void buildModuleDescription(Content moduleContent) {
if (!options.noComment()) {
moduleWriter.addModuleDescription(moduleContentTree);
moduleWriter.addModuleDescription(moduleContent);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -104,12 +104,12 @@ public class PackageSummaryBuilder extends AbstractBuilder {
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildPackageDoc() throws DocletException {
Content contentTree = packageWriter.getPackageHeader();
Content content = packageWriter.getPackageHeader();
buildContent();
packageWriter.addPackageFooter();
packageWriter.printDocument(contentTree);
packageWriter.printDocument(content);
DocFilesHandler docFilesHandler = configuration
.getWriterFactory()
.getDocFilesHandler(packageElement);
@ -122,30 +122,30 @@ public class PackageSummaryBuilder extends AbstractBuilder {
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildContent() throws DocletException {
Content packageContentTree = packageWriter.getContentHeader();
Content packageContent = packageWriter.getContentHeader();
packageWriter.addPackageSignature(packageContentTree);
buildPackageDescription(packageContentTree);
buildPackageTags(packageContentTree);
buildSummary(packageContentTree);
packageWriter.addPackageSignature(packageContent);
buildPackageDescription(packageContent);
buildPackageTags(packageContent);
buildSummary(packageContent);
packageWriter.addPackageContent(packageContentTree);
packageWriter.addPackageContent(packageContent);
}
/**
* Builds the list of summaries for the different kinds of types in this package.
*
* @param packageContentTree the package content tree to which the summaries will
* be added
* @param packageContent the package content to which the summaries will
* be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildSummary(Content packageContentTree) throws DocletException {
protected void buildSummary(Content packageContent) throws DocletException {
Content summariesList = packageWriter.getSummariesList();
buildRelatedPackagesSummary(summariesList);
buildAllClassesAndInterfacesSummary(summariesList);
packageContentTree.add(packageWriter.getPackageSummary(summariesList));
packageContent.add(packageWriter.getPackageSummary(summariesList));
}
/**
@ -170,25 +170,25 @@ public class PackageSummaryBuilder extends AbstractBuilder {
/**
* Build the description of the summary.
*
* @param packageContentTree the tree to which the package description will
* be added
* @param packageContent the content to which the package description will
* be added
*/
protected void buildPackageDescription(Content packageContentTree) {
protected void buildPackageDescription(Content packageContent) {
if (options.noComment()) {
return;
}
packageWriter.addPackageDescription(packageContentTree);
packageWriter.addPackageDescription(packageContent);
}
/**
* Build the tags of the summary.
*
* @param packageContentTree the tree to which the package tags will be added
* @param packageContent the content to which the package tags will be added
*/
protected void buildPackageTags(Content packageContentTree) {
protected void buildPackageTags(Content packageContent) {
if (options.noComment()) {
return;
}
packageWriter.addPackageTags(packageContentTree);
packageWriter.addPackageTags(packageContent);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -109,32 +109,32 @@ public class PropertyBuilder extends AbstractMemberBuilder {
}
@Override
public void build(Content contentTree) throws DocletException {
buildPropertyDoc(contentTree);
public void build(Content target) throws DocletException {
buildPropertyDoc(target);
}
/**
* Build the property documentation.
*
* @param detailsList the content tree to which the documentation will be added
* @param detailsList the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildPropertyDoc(Content detailsList) throws DocletException {
if (hasMembersToDocument()) {
Content propertyDetailsTreeHeader = writer.getPropertyDetailsTreeHeader(detailsList);
Content propertyDetailsHeader = writer.getPropertyDetailsHeader(detailsList);
Content memberList = writer.getMemberList();
for (Element property : properties) {
currentProperty = (ExecutableElement)property;
Content propertyDocTree = writer.getPropertyDocTreeHeader(currentProperty);
Content propertyContent = writer.getPropertyHeaderContent(currentProperty);
buildSignature(propertyDocTree);
buildPropertyComments(propertyDocTree);
buildTagInfo(propertyDocTree);
buildSignature(propertyContent);
buildPropertyComments(propertyContent);
buildTagInfo(propertyContent);
memberList.add(writer.getMemberListItem(propertyDocTree));
memberList.add(writer.getMemberListItem(propertyContent));
}
Content propertyDetails = writer.getPropertyDetails(propertyDetailsTreeHeader, memberList);
Content propertyDetails = writer.getPropertyDetails(propertyDetailsHeader, memberList);
detailsList.add(propertyDetails);
}
}
@ -142,48 +142,48 @@ public class PropertyBuilder extends AbstractMemberBuilder {
/**
* Build the signature.
*
* @param propertyDocTree the content tree to which the documentation will be added
* @param propertyContent the content to which the documentation will be added
*/
protected void buildSignature(Content propertyDocTree) {
propertyDocTree.add(writer.getSignature(currentProperty));
protected void buildSignature(Content propertyContent) {
propertyContent.add(writer.getSignature(currentProperty));
}
/**
* Build the deprecation information.
*
* @param propertyDocTree the content tree to which the documentation will be added
* @param propertyContent the content to which the documentation will be added
*/
protected void buildDeprecationInfo(Content propertyDocTree) {
writer.addDeprecated(currentProperty, propertyDocTree);
protected void buildDeprecationInfo(Content propertyContent) {
writer.addDeprecated(currentProperty, propertyContent);
}
/**
* Build the preview information.
*
* @param propertyDocTree the content tree to which the documentation will be added
* @param propertyContent the content to which the documentation will be added
*/
protected void buildPreviewInfo(Content propertyDocTree) {
writer.addPreview(currentProperty, propertyDocTree);
protected void buildPreviewInfo(Content propertyContent) {
writer.addPreview(currentProperty, propertyContent);
}
/**
* Build the comments for the property. Do nothing if
* {@link BaseOptions#noComment()} is set to true.
*
* @param propertyDocTree the content tree to which the documentation will be added
* @param propertyContent the content to which the documentation will be added
*/
protected void buildPropertyComments(Content propertyDocTree) {
protected void buildPropertyComments(Content propertyContent) {
if (!options.noComment()) {
writer.addComments(currentProperty, propertyDocTree);
writer.addComments(currentProperty, propertyContent);
}
}
/**
* Build the tag information.
*
* @param propertyDocTree the content tree to which the documentation will be added
* @param propertyContent the content to which the documentation will be added
*/
protected void buildTagInfo(Content propertyDocTree) {
protected void buildTagInfo(Content propertyContent) {
CommentUtils cmtUtils = configuration.cmtUtils;
DocCommentTree dct = utils.getDocCommentTree(currentProperty);
var fullBody = dct.getFullBody();
@ -199,7 +199,7 @@ public class PropertyBuilder extends AbstractMemberBuilder {
// the property.
CommentUtils.DocCommentInfo prev = cmtUtils.setDocCommentTree(currentProperty, fullBody, blockTags);
try {
writer.addTags(currentProperty, propertyDocTree);
writer.addTags(currentProperty, propertyContent);
} finally {
cmtUtils.setDocCommentInfo(currentProperty, prev);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -138,13 +138,13 @@ public class SerializedFormBuilder extends AbstractBuilder {
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildSerializedForm() throws DocletException {
Content contentTree = writer.getHeader(resources.getText(
Content content = writer.getHeader(resources.getText(
"doclet.Serialized_Form"));
buildSerializedFormSummaries();
writer.addFooter();
writer.printDocument(contentTree);
writer.printDocument(content);
}
/**
@ -154,23 +154,23 @@ public class SerializedFormBuilder extends AbstractBuilder {
*/
protected void buildSerializedFormSummaries()
throws DocletException {
Content serializedSummariesTree = writer.getSerializedSummariesHeader();
Content c = writer.getSerializedSummariesHeader();
for (PackageElement pkg : configuration.packages) {
currentPackage = pkg;
buildPackageSerializedForm(serializedSummariesTree);
buildPackageSerializedForm(c);
}
writer.addSerializedContent(serializedSummariesTree);
writer.addSerializedContent(c);
}
/**
* Build the package serialized form for the current package being processed.
*
* @param serializedSummariesTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildPackageSerializedForm(Content serializedSummariesTree) throws DocletException {
Content packageSerializedTree = writer.getPackageSerializedHeader();
protected void buildPackageSerializedForm(Content target) throws DocletException {
Content packageSerializedHeader = writer.getPackageSerializedHeader();
SortedSet<TypeElement> classes = utils.getAllClassesUnfiltered(currentPackage);
if (classes.isEmpty()) {
return;
@ -182,30 +182,30 @@ public class SerializedFormBuilder extends AbstractBuilder {
return;
}
buildPackageHeader(packageSerializedTree);
buildClassSerializedForm(packageSerializedTree);
buildPackageHeader(packageSerializedHeader);
buildClassSerializedForm(packageSerializedHeader);
writer.addPackageSerializedTree(serializedSummariesTree, packageSerializedTree);
writer.addPackageSerialized(target, packageSerializedHeader);
}
/**
* Build the package header.
*
* @param packageSerializedTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildPackageHeader(Content packageSerializedTree) {
packageSerializedTree.add(writer.getPackageHeader(currentPackage));
protected void buildPackageHeader(Content target) {
target.add(writer.getPackageHeader(currentPackage));
}
/**
* Build the class serialized form.
*
* @param packageSerializedTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildClassSerializedForm(Content packageSerializedTree)
protected void buildClassSerializedForm(Content target)
throws DocletException {
Content classSerializedTree = writer.getClassSerializedHeader();
Content classSerializedHeader = writer.getClassSerializedHeader();
SortedSet<TypeElement> typeElements = utils.getAllClassesUnfiltered(currentPackage);
for (TypeElement typeElement : typeElements) {
currentTypeElement = typeElement;
@ -215,82 +215,82 @@ public class SerializedFormBuilder extends AbstractBuilder {
if (!serialClassInclude(utils, currentTypeElement)) {
continue;
}
Content classTree = writer.getClassHeader(currentTypeElement);
Content classHeader = writer.getClassHeader(currentTypeElement);
buildSerialUIDInfo(classTree);
buildClassContent(classTree);
buildSerialUIDInfo(classHeader);
buildClassContent(classHeader);
classSerializedTree.add(writer.getMemberTree(classTree));
classSerializedHeader.add(writer.getMember(classHeader));
}
}
packageSerializedTree.add(classSerializedTree);
target.add(classSerializedHeader);
}
/**
* Build the serial UID information for the given class.
*
* @param classTree content tree to which the serial UID information will be added
* @param target the content to which the serial UID information will be added
*/
protected void buildSerialUIDInfo(Content classTree) {
Content serialUidTree = writer.getSerialUIDInfoHeader();
protected void buildSerialUIDInfo(Content target) {
Content serialUIDHeader = writer.getSerialUIDInfoHeader();
for (VariableElement field : utils.getFieldsUnfiltered(currentTypeElement)) {
if (field.getSimpleName().toString().compareTo(SERIAL_VERSION_UID) == 0 &&
field.getConstantValue() != null) {
writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
utils.constantValueExpression(field), serialUidTree);
utils.constantValueExpression(field), serialUIDHeader);
break;
}
}
classTree.add(serialUidTree);
target.add(serialUIDHeader);
}
/**
* Build the summaries for the methods and fields.
*
* @param classTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildClassContent(Content classTree) throws DocletException {
Content classContentTree = writer.getClassContentHeader();
protected void buildClassContent(Content target) throws DocletException {
Content classContent = writer.getClassContentHeader();
buildSerializableMethods(classContentTree);
buildFieldHeader(classContentTree);
buildSerializableFields(classContentTree);
buildSerializableMethods(classContent);
buildFieldHeader(classContent);
buildSerializableFields(classContent);
classTree.add(classContentTree);
target.add(classContent);
}
/**
* Build the summaries for the methods that belong to the given class.
*
* @param classContentTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildSerializableMethods(Content classContentTree) throws DocletException {
Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
protected void buildSerializableMethods(Content target) throws DocletException {
Content serializableMethodsHeader = methodWriter.getSerializableMethodsHeader();
SortedSet<ExecutableElement> members = utils.serializationMethods(currentTypeElement);
if (!members.isEmpty()) {
for (ExecutableElement member : members) {
currentMember = member;
Content methodsContentTree = methodWriter.getMethodsContentHeader(
Content methodsContent = methodWriter.getMethodsContentHeader(
currentMember == members.last());
buildMethodSubHeader(methodsContentTree);
buildDeprecatedMethodInfo(methodsContentTree);
buildMethodInfo(methodsContentTree);
buildMethodSubHeader(methodsContent);
buildDeprecatedMethodInfo(methodsContent);
buildMethodInfo(methodsContent);
serializableMethodTree.add(methodsContentTree);
serializableMethodsHeader.add(methodsContent);
}
}
if (!utils.serializationMethods(currentTypeElement).isEmpty()) {
classContentTree.add(methodWriter.getSerializableMethods(
target.add(methodWriter.getSerializableMethods(
resources.getText("doclet.Serialized_Form_methods"),
serializableMethodTree));
serializableMethodsHeader));
if (utils.isSerializable(currentTypeElement) && !utils.isExternalizable(currentTypeElement)) {
if (utils.serializationMethods(currentTypeElement).isEmpty()) {
Content noCustomizationMsg = methodWriter.getNoCustomizationMsg(
resources.getText("doclet.Serializable_no_customization"));
classContentTree.add(methodWriter.getSerializableMethods(
target.add(methodWriter.getSerializableMethods(
resources.getText("doclet.Serialized_Form_methods"),
noCustomizationMsg));
}
@ -301,52 +301,52 @@ public class SerializedFormBuilder extends AbstractBuilder {
/**
* Build the method sub header.
*
* @param methodsContentTree content tree to which the documentation will be added
* @param methodsContent the content to which the documentation will be added
*/
protected void buildMethodSubHeader(Content methodsContentTree) {
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
protected void buildMethodSubHeader(Content methodsContent) {
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContent);
}
/**
* Build the deprecated method description.
*
* @param methodsContentTree content tree to which the documentation will be added
* @param methodsContent the content to which the documentation will be added
*/
protected void buildDeprecatedMethodInfo(Content methodsContentTree) {
methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree);
protected void buildDeprecatedMethodInfo(Content methodsContent) {
methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContent);
}
/**
* Build the information for the method.
*
* @param methodsContentTree content tree to which the documentation will be added
* @param methodsContent the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildMethodInfo(Content methodsContentTree) throws DocletException {
protected void buildMethodInfo(Content methodsContent) throws DocletException {
if (options.noComment()) {
return;
}
buildMethodDescription(methodsContentTree);
buildMethodTags(methodsContentTree);
buildMethodDescription(methodsContent);
buildMethodTags(methodsContent);
}
/**
* Build method description.
*
* @param methodsContentTree content tree to which the documentation will be added
* @param methodsContent the content to which the documentation will be added
*/
protected void buildMethodDescription(Content methodsContentTree) {
methodWriter.addMemberDescription((ExecutableElement)currentMember, methodsContentTree);
protected void buildMethodDescription(Content methodsContent) {
methodWriter.addMemberDescription((ExecutableElement)currentMember, methodsContent);
}
/**
* Build the method tags.
*
* @param methodsContentTree content tree to which the documentation will be added
* @param methodsContent the content to which the documentation will be added
*/
protected void buildMethodTags(Content methodsContentTree) {
methodWriter.addMemberTags((ExecutableElement)currentMember, methodsContentTree);
protected void buildMethodTags(Content methodsContent) {
methodWriter.addMemberTags((ExecutableElement)currentMember, methodsContent);
ExecutableElement method = (ExecutableElement)currentMember;
if (method.getSimpleName().toString().compareTo("writeExternal") == 0
&& utils.getSerialDataTrees(method).isEmpty()) {
@ -362,11 +362,11 @@ public class SerializedFormBuilder extends AbstractBuilder {
/**
* Build the field header.
*
* @param classContentTree content tree to which the documentation will be added
* @param classContent the content to which the documentation will be added
*/
protected void buildFieldHeader(Content classContentTree) {
protected void buildFieldHeader(Content classContent) {
if (!utils.serializableFields(currentTypeElement).isEmpty()) {
buildFieldSerializationOverview(currentTypeElement, classContentTree);
buildFieldSerializationOverview(currentTypeElement, classContent);
}
}
@ -374,25 +374,25 @@ public class SerializedFormBuilder extends AbstractBuilder {
* Build the serialization overview for the given class.
*
* @param typeElement the class to print the overview for.
* @param classContentTree content tree to which the documentation will be added
* @param classContent the content to which the documentation will be added
*/
public void buildFieldSerializationOverview(TypeElement typeElement, Content classContentTree) {
public void buildFieldSerializationOverview(TypeElement typeElement, Content classContent) {
if (utils.definesSerializableFields(typeElement)) {
VariableElement ve = utils.serializableFields(typeElement).first();
// Check to see if there are inline comments, tags or deprecation
// information to be printed.
if (fieldWriter.shouldPrintOverview(ve)) {
Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
Content fieldsOverviewContentTree = fieldWriter.getFieldsContentHeader(true);
fieldWriter.addMemberDeprecatedInfo(ve, fieldsOverviewContentTree);
Content serializableFieldsHeader = fieldWriter.getSerializableFieldsHeader();
Content fieldsOverviewContent = fieldWriter.getFieldsContentHeader(true);
fieldWriter.addMemberDeprecatedInfo(ve, fieldsOverviewContent);
if (!options.noComment()) {
fieldWriter.addMemberDescription(ve, fieldsOverviewContentTree);
fieldWriter.addMemberTags(ve, fieldsOverviewContentTree);
fieldWriter.addMemberDescription(ve, fieldsOverviewContent);
fieldWriter.addMemberTags(ve, fieldsOverviewContent);
}
serializableFieldsTree.add(fieldsOverviewContentTree);
classContentTree.add(fieldWriter.getSerializableFields(
serializableFieldsHeader.add(fieldsOverviewContent);
classContent.add(fieldWriter.getSerializableFields(
resources.getText("doclet.Serialized_Form_class"),
serializableFieldsTree));
serializableFieldsHeader));
}
}
}
@ -400,67 +400,67 @@ public class SerializedFormBuilder extends AbstractBuilder {
/**
* Build the summaries for the fields that belong to the given class.
*
* @param classContentTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildSerializableFields(Content classContentTree)
protected void buildSerializableFields(Content target)
throws DocletException {
SortedSet<VariableElement> members = utils.serializableFields(currentTypeElement);
if (!members.isEmpty()) {
Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
Content serializableFieldsHeader = fieldWriter.getSerializableFieldsHeader();
for (VariableElement ve : members) {
currentMember = ve;
if (!utils.definesSerializableFields(currentTypeElement)) {
Content fieldsContentTree = fieldWriter.getFieldsContentHeader(
Content fieldsContent = fieldWriter.getFieldsContentHeader(
currentMember == members.last());
buildFieldSubHeader(fieldsContentTree);
buildFieldDeprecationInfo(fieldsContentTree);
buildFieldInfo(fieldsContentTree);
buildFieldSubHeader(fieldsContent);
buildFieldDeprecationInfo(fieldsContent);
buildFieldInfo(fieldsContent);
serializableFieldsTree.add(fieldsContentTree);
serializableFieldsHeader.add(fieldsContent);
} else {
buildSerialFieldTagsInfo(serializableFieldsTree);
buildSerialFieldTagsInfo(serializableFieldsHeader);
}
}
classContentTree.add(fieldWriter.getSerializableFields(
target.add(fieldWriter.getSerializableFields(
resources.getText("doclet.Serialized_Form_fields"),
serializableFieldsTree));
serializableFieldsHeader));
}
}
/**
* Build the field sub header.
*
* @param fieldsContentTree content tree to which the documentation will be added
* @param fieldsContent the content to which the documentation will be added
*/
protected void buildFieldSubHeader(Content fieldsContentTree) {
protected void buildFieldSubHeader(Content fieldsContent) {
if (!utils.definesSerializableFields(currentTypeElement)) {
VariableElement field = (VariableElement) currentMember;
fieldWriter.addMemberHeader(field.asType(),
utils.getSimpleName(field),
fieldsContentTree);
fieldsContent);
}
}
/**
* Build the field deprecation information.
*
* @param fieldsContentTree content tree to which the documentation will be added
* @param fieldsContent the content to which the documentation will be added
*/
protected void buildFieldDeprecationInfo(Content fieldsContentTree) {
protected void buildFieldDeprecationInfo(Content fieldsContent) {
if (!utils.definesSerializableFields(currentTypeElement)) {
fieldWriter.addMemberDeprecatedInfo((VariableElement)currentMember,
fieldsContentTree);
fieldsContent);
}
}
/**
* Build the serial field tags information.
*
* @param serializableFieldsTree content tree to which the documentation will be added
* @param target the content to which the documentation will be added
*/
protected void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
protected void buildSerialFieldTagsInfo(Content target) {
if (options.noComment()) {
return;
}
@ -477,20 +477,20 @@ public class SerializedFormBuilder extends AbstractBuilder {
for (SerialFieldTree tag : tags) {
if (tag.getName() == null || tag.getType() == null) // ignore malformed @serialField tags
continue;
Content fieldsContentTree = fieldWriter.getFieldsContentHeader(tag.equals(tags.last()));
Content fieldsContent = fieldWriter.getFieldsContentHeader(tag.equals(tags.last()));
TypeMirror type = ch.getReferencedType(tag);
fieldWriter.addMemberHeader(type, tag.getName().getName().toString(), fieldsContentTree);
fieldWriter.addMemberDescription(field, tag, fieldsContentTree);
serializableFieldsTree.add(fieldsContentTree);
fieldWriter.addMemberHeader(type, tag.getName().getName().toString(), fieldsContent);
fieldWriter.addMemberDescription(field, tag, fieldsContent);
target.add(fieldsContent);
}
}
/**
* Build the field information.
*
* @param fieldsContentTree content tree to which the documentation will be added
* @param fieldsContent the content to which the documentation will be added
*/
protected void buildFieldInfo(Content fieldsContentTree) {
protected void buildFieldInfo(Content fieldsContent) {
if (options.noComment()) {
return;
}
@ -503,8 +503,8 @@ public class SerializedFormBuilder extends AbstractBuilder {
"doclet.MissingSerialTag", utils.getFullyQualifiedName(te),
utils.getSimpleName(field));
}
fieldWriter.addMemberDescription(field, fieldsContentTree);
fieldWriter.addMemberTags(field, fieldsContentTree);
fieldWriter.addMemberDescription(field, fieldsContent);
fieldWriter.addMemberTags(field, fieldsContent);
}
/**

View File

@ -56,9 +56,7 @@ public abstract class LinkFactory {
}
/**
* Returns an empty instance of a content object.
*
* @return an empty instance of a content object.
* {@return a new instance of a content object}
*/
protected abstract Content newContent();
@ -66,7 +64,7 @@ public abstract class LinkFactory {
* Constructs a link from the given link information.
*
* @param linkInfo the information about the link.
* @return the output of the link.
* @return the link.
*/
public Content getLink(LinkInfo linkInfo) {
if (linkInfo.type != null) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -93,9 +93,7 @@ public abstract class LinkInfo {
public boolean skipPreview;
/**
* Returns an empty instance of a content object.
*
* @return an empty instance of a content object.
* {@return a new instance of a content object}
*/
protected abstract Content newContent();