8312044: Simplify toolkit Builder/Writer world
Reviewed-by: prappo
This commit is contained in:
parent
f4ba7b2198
commit
3c644dc586
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets
formats/html
AbstractExecutableMemberWriter.javaAbstractMemberWriter.javaAbstractOverviewIndexWriter.javaAbstractTreeWriter.javaAllClassesIndexWriter.javaAllPackagesIndexWriter.javaAnnotationTypeMemberWriter.javaClassUseWriter.javaClassWriter.javaClassWriterImpl.javaConstantsSummaryWriter.javaConstantsSummaryWriterImpl.javaConstructorWriter.javaContent.javaContents.javaDeprecatedListWriter.javaDocFilesHandler.javaEnumConstantWriter.javaExternalSpecsWriter.javaFieldWriter.javaHelpWriter.javaHtmlConfiguration.javaHtmlDoclet.javaHtmlDocletWriter.javaHtmlLinkFactory.javaHtmlLinkInfo.javaIndexRedirectWriter.javaIndexWriter.javaMethodWriter.javaModuleIndexWriter.javaModuleWriter.javaNavigation.javaNestedClassWriter.javaNewAPIListWriter.javaPackageIndexWriter.javaPackageTreeWriter.javaPackageUseWriter.javaPackageWriter.javaPreviewListWriter.javaPropertyWriter.javaSearchWriter.javaSerialFieldWriter.javaSerialMethodWriter.javaSerializedFormWriter.javaSerializedFormWriterImpl.javaSignatures.javaSourceToHTMLConverter.javaSubWriterHolderWriter.javaSummaryListWriter.javaSystemPropertiesWriter.javaTable.javaTableHeader.javaTreeWriter.javaWriterFactory.javaWriterFactoryImpl.java
markup
BodyContents.javaComment.javaContentBuilder.javaEntity.javaHead.javaHtmlDocument.javaHtmlTree.javaLinks.javaRawHtml.javaScript.javaText.javaTextBuilder.java
taglets
BaseTaglet.javaDeprecatedTaglet.javaDocRootTaglet.javaIndexTaglet.javaInheritDocTaglet.javaLinkTaglet.javaLiteralTaglet.javaParamTaglet.javaReturnTaglet.javaSeeTaglet.javaSimpleTaglet.javaSnippetTaglet.javaSpecTaglet.javaSummaryTaglet.javaSystemPropertyTaglet.javaTaglet.javaTagletWriter.javaThrowsTaglet.javaUserTaglet.javaValueTaglet.java
toolkit
@ -43,7 +43,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
|
||||
import static jdk.javadoc.internal.doclets.formats.html.HtmlLinkInfo.Kind.LINK_TYPE_PARAMS;
|
||||
import static jdk.javadoc.internal.doclets.formats.html.HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS;
|
||||
|
104
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
104
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
@ -42,16 +42,14 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Links;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
/**
|
||||
* The base class for member writers.
|
||||
*/
|
||||
public abstract class AbstractMemberWriter implements MemberSummaryWriter, MemberWriter {
|
||||
public abstract class AbstractMemberWriter {
|
||||
|
||||
protected final HtmlConfiguration configuration;
|
||||
protected final HtmlOptions options;
|
||||
@ -80,6 +78,33 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
|
||||
this(writer, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the member summary header for the given class.
|
||||
*
|
||||
* @param typeElement the class the summary belongs to
|
||||
* @param content the content to which the member summary will be added
|
||||
*
|
||||
* @return the member summary header
|
||||
*/
|
||||
public abstract Content getMemberSummaryHeader(TypeElement typeElement, Content content);
|
||||
/**
|
||||
* Adds the given summary to the list of summaries.
|
||||
*
|
||||
* @param summariesList the list of summaries
|
||||
* @param content the summary
|
||||
*/
|
||||
public abstract void addSummary(Content summariesList, Content content);
|
||||
|
||||
/**
|
||||
* Returns a list of visible elements of the specified kind in this
|
||||
* type element.
|
||||
* @param kind of members
|
||||
* @return a list of members
|
||||
*/
|
||||
protected List<Element> getVisibleMembers(VisibleMemberTable.Kind kind) {
|
||||
return configuration.getVisibleMemberTable(typeElement).getVisibleMembers(kind);
|
||||
}
|
||||
|
||||
/* ----- abstracts ----- */
|
||||
|
||||
/**
|
||||
@ -340,11 +365,17 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Adds the member summary for the given class and member.
|
||||
*
|
||||
* @param tElement the class the summary belongs to
|
||||
* @param member the member that is documented
|
||||
* @param firstSentenceTrees the tags for the sentence being documented
|
||||
*/
|
||||
public void addMemberSummary(TypeElement tElement, Element member,
|
||||
List<? extends DocTree> firstSentenceTrees) {
|
||||
if (tElement != typeElement) {
|
||||
throw new IllegalStateException();
|
||||
throw new IllegalStateException(tElement + ", " + typeElement);
|
||||
}
|
||||
var table = getSummaryTable();
|
||||
List<Content> rowContents = new ArrayList<>();
|
||||
@ -361,26 +392,50 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
|
||||
table.addRow(member, rowContents);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Adds the inherited member summary for the given class and member.
|
||||
*
|
||||
* @param tElement the class the inherited member belongs to
|
||||
* @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 content the content to which the links will be added
|
||||
*/
|
||||
public void addInheritedMemberSummary(TypeElement tElement,
|
||||
Element nestedClass, boolean isFirst, boolean isLast,
|
||||
Element member, boolean isFirst, boolean isLast,
|
||||
Content content) {
|
||||
writer.addInheritedMemberSummary(this, tElement, nestedClass, isFirst, content);
|
||||
writer.addInheritedMemberSummary(this, tElement, member, isFirst, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the inherited member summary header for the given class.
|
||||
*
|
||||
* @param tElement the class the summary belongs to
|
||||
*
|
||||
* @return the inherited member summary header
|
||||
*/
|
||||
public Content getInheritedSummaryHeader(TypeElement tElement) {
|
||||
Content c = writer.getMemberInherited();
|
||||
writer.addInheritedSummaryHeader(this, tElement, c);
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the inherited summary links.
|
||||
*
|
||||
* @return the inherited summary links
|
||||
*/
|
||||
public Content getInheritedSummaryLinks() {
|
||||
return new HtmlTree(TagName.CODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the summary table for the given class.
|
||||
*
|
||||
* @param tElement the class the summary table belongs to
|
||||
*
|
||||
* @return the summary table
|
||||
*/
|
||||
public Content getSummaryTable(TypeElement tElement) {
|
||||
if (tElement != typeElement) {
|
||||
throw new IllegalStateException();
|
||||
@ -388,18 +443,33 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
|
||||
return getSummaryTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the member content.
|
||||
*
|
||||
* @param memberContent the content representing the member
|
||||
*
|
||||
* @return the member content
|
||||
*/
|
||||
public Content getMember(Content memberContent) {
|
||||
return writer.getMember(memberContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberList() {
|
||||
/**
|
||||
* {@return a list to add member items to}
|
||||
*
|
||||
* @see #getMemberListItem(Content)
|
||||
*/
|
||||
protected Content getMemberList() {
|
||||
return writer.getMemberList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberListItem(Content memberContent) {
|
||||
/**
|
||||
* {@return a member item}
|
||||
*
|
||||
* @param memberContent the member to represent as an item
|
||||
* @see #getMemberList()
|
||||
*/
|
||||
protected Content getMemberListItem(Content memberContent) {
|
||||
return writer.getMemberListItem(memberContent);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
||||
|
@ -28,7 +28,6 @@ package jdk.javadoc.internal.doclets.formats.html;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree.Hierarchy;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
7
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java
7
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java
@ -37,7 +37,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
@ -117,10 +116,10 @@ public class AllClassesIndexWriter extends HtmlDocletWriter {
|
||||
.setId(HtmlIds.ALL_CLASSES_TABLE)
|
||||
.setDefaultTab(contents.allClassesAndInterfacesLabel)
|
||||
.addTab(contents.interfaces, utils::isPlainInterface)
|
||||
.addTab(contents.classes, e -> utils.isNonThrowableClass(e))
|
||||
.addTab(contents.classes, utils::isNonThrowableClass)
|
||||
.addTab(contents.enums, utils::isEnum)
|
||||
.addTab(contents.records, e -> utils.isRecord(e))
|
||||
.addTab(contents.exceptionClasses, e -> utils.isThrowable(e))
|
||||
.addTab(contents.records, utils::isRecord)
|
||||
.addTab(contents.exceptionClasses, utils::isThrowable)
|
||||
.addTab(contents.annotationTypes, utils::isAnnotationInterface);
|
||||
for (Character unicode : indexBuilder.getFirstCharacters()) {
|
||||
for (IndexItem indexItem : indexBuilder.getItems(unicode)) {
|
||||
|
1
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java
1
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java
@ -33,7 +33,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
@ -37,16 +37,15 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeMemberWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
|
||||
/**
|
||||
* Writes annotation interface member documentation in HTML format.
|
||||
*/
|
||||
public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
|
||||
implements AnnotationTypeMemberWriter, MemberSummaryWriter {
|
||||
public class AnnotationTypeMemberWriter extends AbstractMemberWriter {
|
||||
|
||||
/**
|
||||
* We generate separate summaries for required and optional annotation interface members,
|
||||
@ -61,12 +60,18 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
|
||||
|
||||
private final Kind kind;
|
||||
|
||||
/**
|
||||
* The index of the current member that is being documented at this point
|
||||
* in time.
|
||||
*/
|
||||
protected Element currentMember;
|
||||
|
||||
/**
|
||||
* Constructs a new AnnotationTypeMemberWriterImpl for any kind of member.
|
||||
*
|
||||
* @param writer The writer for the class that the member belongs to.
|
||||
*/
|
||||
public AnnotationTypeMemberWriterImpl(SubWriterHolderWriter writer) {
|
||||
public AnnotationTypeMemberWriter(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
this.kind = Kind.ANY;
|
||||
}
|
||||
@ -78,13 +83,110 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
|
||||
* @param annotationType the AnnotationType that holds this member.
|
||||
* @param kind the kind of annotation interface members to handle.
|
||||
*/
|
||||
public AnnotationTypeMemberWriterImpl(SubWriterHolderWriter writer,
|
||||
TypeElement annotationType,
|
||||
Kind kind) {
|
||||
public AnnotationTypeMemberWriter(SubWriterHolderWriter writer,
|
||||
TypeElement annotationType,
|
||||
Kind kind) {
|
||||
super(writer, annotationType);
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
public void build(Content target) throws DocletException {
|
||||
buildAnnotationTypeMember(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the member documentation.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildAnnotationTypeMember(Content target) {
|
||||
// In contrast to the annotation interface member summaries the details generated
|
||||
// by this builder share a single list for both required and optional members.
|
||||
var members = getVisibleMembers(VisibleMemberTable.Kind.ANNOTATION_TYPE_MEMBER);
|
||||
if (!members.isEmpty()) {
|
||||
addAnnotationDetailsMarker(target);
|
||||
Content annotationDetailsHeader = getAnnotationDetailsHeader();
|
||||
Content memberList = getMemberList();
|
||||
|
||||
for (Element member : members) {
|
||||
currentMember = member;
|
||||
Content annotationContent = getAnnotationHeaderContent(currentMember);
|
||||
|
||||
buildAnnotationTypeMemberChildren(annotationContent);
|
||||
|
||||
memberList.add(writer.getMemberListItem(annotationContent));
|
||||
}
|
||||
Content annotationDetails = getAnnotationDetails(annotationDetailsHeader, memberList);
|
||||
target.add(annotationDetails);
|
||||
}
|
||||
}
|
||||
|
||||
protected void buildAnnotationTypeMemberChildren(Content annotationContent) {
|
||||
buildSignature(annotationContent);
|
||||
buildDeprecationInfo(annotationContent);
|
||||
buildPreviewInfo(annotationContent);
|
||||
buildMemberComments(annotationContent);
|
||||
buildTagInfo(annotationContent);
|
||||
buildDefaultValueInfo(annotationContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildSignature(Content target) {
|
||||
target.add(getSignature(currentMember));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the deprecation information.
|
||||
*
|
||||
* @param annotationContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildDeprecationInfo(Content annotationContent) {
|
||||
addDeprecated(currentMember, annotationContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the preview information.
|
||||
*
|
||||
* @param annotationContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPreviewInfo(Content annotationContent) {
|
||||
addPreview(currentMember, annotationContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the comments for the member. Do nothing if
|
||||
* {@link BaseOptions#noComment()} is set to true.
|
||||
*
|
||||
* @param annotationContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildMemberComments(Content annotationContent) {
|
||||
if (!options.noComment()) {
|
||||
addComments(currentMember, annotationContent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information.
|
||||
*
|
||||
* @param annotationContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildTagInfo(Content annotationContent) {
|
||||
addTags(currentMember, annotationContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the default value for this optional member.
|
||||
*
|
||||
* @param annotationContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildDefaultValueInfo(Content annotationContent) {
|
||||
addDefaultValueInfo(currentMember, annotationContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberSummaryHeader(TypeElement typeElement,
|
||||
Content content) {
|
||||
@ -102,8 +204,7 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberHeader() {
|
||||
protected Content getMemberHeader() {
|
||||
return writer.getMemberHeader();
|
||||
}
|
||||
|
||||
@ -118,15 +219,13 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
|
||||
summariesList, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAnnotationDetailsMarker(Content memberDetails) {
|
||||
protected void addAnnotationDetailsMarker(Content memberDetails) {
|
||||
memberDetails.add(selectComment(
|
||||
MarkerComments.START_OF_ANNOTATION_TYPE_DETAILS,
|
||||
MarkerComments.START_OF_ANNOTATION_INTERFACE_DETAILS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getAnnotationDetailsHeader() {
|
||||
protected Content getAnnotationDetailsHeader() {
|
||||
Content memberDetails = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
|
||||
contents.annotationTypeDetailsLabel);
|
||||
@ -134,8 +233,7 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
|
||||
return memberDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getAnnotationHeaderContent(Element member) {
|
||||
protected Content getAnnotationHeaderContent(Element member) {
|
||||
Content content = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
|
||||
Text.of(name(member)));
|
||||
@ -144,36 +242,30 @@ public class AnnotationTypeMemberWriterImpl extends AbstractMemberWriter
|
||||
.setId(htmlIds.forMember(typeElement, (ExecutableElement) member));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSignature(Element member) {
|
||||
protected Content getSignature(Element member) {
|
||||
return new Signatures.MemberSignature(member, this)
|
||||
.setType(getType(member))
|
||||
.setAnnotations(writer.getAnnotationInfo(member, true))
|
||||
.toContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeprecated(Element member, Content target) {
|
||||
protected void addDeprecated(Element member, Content target) {
|
||||
addDeprecatedInfo(member, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPreview(Element member, Content content) {
|
||||
protected void addPreview(Element member, Content content) {
|
||||
addPreviewInfo(member, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComments(Element member, Content annotationContent) {
|
||||
protected void addComments(Element member, Content annotationContent) {
|
||||
addComment(member, annotationContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(Element member, Content annotationContent) {
|
||||
protected void addTags(Element member, Content annotationContent) {
|
||||
writer.addTagsInfo(member, annotationContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getAnnotationDetails(Content annotationDetailsHeader, Content annotationDetails) {
|
||||
protected Content getAnnotationDetails(Content annotationDetailsHeader, Content annotationDetails) {
|
||||
Content c = new ContentBuilder(annotationDetailsHeader, annotationDetails);
|
||||
return getMember(HtmlTree.SECTION(HtmlStyle.memberDetails, c));
|
||||
}
|
@ -43,7 +43,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
@ -81,10 +80,10 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
final Map<PackageElement, List<Element>> pkgToConstructorArgTypeParameter;
|
||||
final Map<PackageElement, List<Element>> pkgToConstructorThrows;
|
||||
final SortedSet<PackageElement> pkgSet;
|
||||
final MethodWriterImpl methodSubWriter;
|
||||
final ConstructorWriterImpl constrSubWriter;
|
||||
final FieldWriterImpl fieldSubWriter;
|
||||
final NestedClassWriterImpl classSubWriter;
|
||||
final MethodWriter methodSubWriter;
|
||||
final ConstructorWriter constrSubWriter;
|
||||
final FieldWriter fieldSubWriter;
|
||||
final NestedClassWriter classSubWriter;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -132,11 +131,11 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
+ pkgSet + " with: " + mapper.classToPackage.get(this.typeElement));
|
||||
}
|
||||
|
||||
methodSubWriter = new MethodWriterImpl(this);
|
||||
constrSubWriter = new ConstructorWriterImpl(this);
|
||||
methodSubWriter = new MethodWriter(this);
|
||||
constrSubWriter = new ConstructorWriter(this);
|
||||
constrSubWriter.setFoundNonPubConstructor(true);
|
||||
fieldSubWriter = new FieldWriterImpl(this);
|
||||
classSubWriter = new NestedClassWriterImpl(this);
|
||||
fieldSubWriter = new FieldWriter(this);
|
||||
classSubWriter = new NestedClassWriter(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
1093
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriter.java
Normal file
1093
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriter.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,470 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.SimpleElementVisitor8;
|
||||
|
||||
import com.sun.source.doctree.DeprecatedTree;
|
||||
import com.sun.source.doctree.DocTree;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
/**
|
||||
* Generate the Class Information Page.
|
||||
*
|
||||
* @see javax.lang.model.element.TypeElement
|
||||
*/
|
||||
public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWriter {
|
||||
|
||||
private static final Set<String> suppressSubtypesSet
|
||||
= Set.of("java.lang.Object",
|
||||
"org.omg.CORBA.Object");
|
||||
|
||||
private static final Set<String> suppressImplementingSet
|
||||
= Set.of("java.lang.Cloneable",
|
||||
"java.lang.constant.Constable",
|
||||
"java.lang.constant.ConstantDesc",
|
||||
"java.io.Serializable");
|
||||
|
||||
protected final TypeElement typeElement;
|
||||
|
||||
protected final ClassTree classTree;
|
||||
|
||||
/**
|
||||
* @param configuration the configuration data for the doclet
|
||||
* @param typeElement the class being documented.
|
||||
* @param classTree the class tree for the given class.
|
||||
*/
|
||||
public ClassWriterImpl(HtmlConfiguration configuration, TypeElement typeElement,
|
||||
ClassTree classTree) {
|
||||
super(configuration, configuration.docPaths.forClass(typeElement));
|
||||
this.typeElement = typeElement;
|
||||
configuration.currentTypeElement = typeElement;
|
||||
this.classTree = classTree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getOutputInstance() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getHeader(String header) {
|
||||
HtmlTree body = getBody(getWindowTitle(utils.getSimpleName(typeElement)));
|
||||
var div = HtmlTree.DIV(HtmlStyle.header);
|
||||
if (configuration.showModules) {
|
||||
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
|
||||
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())));
|
||||
div.add(moduleNameDiv);
|
||||
}
|
||||
PackageElement pkg = utils.containingPackage(typeElement);
|
||||
if (!pkg.isUnnamed()) {
|
||||
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);
|
||||
div.add(pkgNameDiv);
|
||||
}
|
||||
HtmlLinkInfo linkInfo = new HtmlLinkInfo(configuration,
|
||||
HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS_AND_BOUNDS, typeElement)
|
||||
.linkToSelf(false); // Let's not link to ourselves in the header
|
||||
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 body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getClassContentHeader() {
|
||||
return getContentHeader();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Navigation getNavBar(PageMode pageMode, Element element) {
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(element),
|
||||
contents.moduleLabel);
|
||||
return super.getNavBar(pageMode, element)
|
||||
.setNavLinkModule(linkContent)
|
||||
.setSubNavLinks(() -> {
|
||||
List<Content> list = new ArrayList<>();
|
||||
VisibleMemberTable vmt = configuration.getVisibleMemberTable(typeElement);
|
||||
Set<VisibleMemberTable.Kind> summarySet =
|
||||
VisibleMemberTable.Kind.forSummariesOf(element.getKind());
|
||||
for (VisibleMemberTable.Kind kind : summarySet) {
|
||||
list.add(links.createLink(HtmlIds.forMemberSummary(kind),
|
||||
contents.getNavLinkLabelContent(kind), vmt.hasVisibleMembers(kind)));
|
||||
}
|
||||
return list;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFooter() {
|
||||
bodyContents.addMainContent(MarkerComments.END_OF_CLASS_DATA);
|
||||
bodyContents.setFooter(getFooter());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDocument(Content content) throws DocFileIOException {
|
||||
String description = getDescription("declaration", typeElement);
|
||||
PackageElement pkg = utils.containingPackage(typeElement);
|
||||
List<DocPath> localStylesheets = getLocalStylesheets(pkg);
|
||||
content.add(bodyContents);
|
||||
printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement),
|
||||
description, localStylesheets, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getClassInfo(Content classInfo) {
|
||||
return getMember(HtmlIds.CLASS_DESCRIPTION, HtmlStyle.classDescription, classInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeElement getCurrentPageElement() {
|
||||
return typeElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addClassSignature(Content classInfo) {
|
||||
classInfo.add(new HtmlTree(TagName.HR));
|
||||
classInfo.add(new Signatures.TypeSignature(typeElement, this)
|
||||
.toContent());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addClassDescription(Content classInfo) {
|
||||
addPreviewInfo(classInfo);
|
||||
if (!options.noComment()) {
|
||||
// generate documentation for the class.
|
||||
if (!utils.getFullBody(typeElement).isEmpty()) {
|
||||
addInlineComment(typeElement, classInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addPreviewInfo(Content content) {
|
||||
addPreviewInfo(typeElement, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addClassTagInfo(Content classInfo) {
|
||||
if (!options.noComment()) {
|
||||
// Print Information about all the tags here
|
||||
addTagsInfo(typeElement, classInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class inheritance tree for the given class.
|
||||
*
|
||||
* @param type the class to get the inheritance tree for
|
||||
* @return the class inheritance tree
|
||||
*/
|
||||
private Content getClassInheritanceTreeContent(TypeMirror type) {
|
||||
TypeMirror sup;
|
||||
HtmlTree classTree = null;
|
||||
do {
|
||||
sup = utils.getFirstVisibleSuperClass(type);
|
||||
var entry = HtmlTree.DIV(HtmlStyle.inheritance, getClassHelperContent(type));
|
||||
if (classTree != null)
|
||||
entry.add(classTree);
|
||||
classTree = entry;
|
||||
type = sup;
|
||||
} while (sup != null);
|
||||
classTree.put(HtmlAttr.TITLE, contents.getContent("doclet.Inheritance_Tree").toString());
|
||||
return classTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class helper for the given class.
|
||||
*
|
||||
* @param type the class to get the helper for
|
||||
* @return the class helper
|
||||
*/
|
||||
private Content getClassHelperContent(TypeMirror type) {
|
||||
Content result = new ContentBuilder();
|
||||
if (utils.typeUtils.isSameType(type, typeElement.asType())) {
|
||||
Content typeParameters = getTypeParameterLinks(
|
||||
new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS,
|
||||
typeElement));
|
||||
if (configuration.shouldExcludeQualifier(utils.containingPackage(typeElement).toString())) {
|
||||
result.add(utils.asTypeElement(type).getSimpleName());
|
||||
result.add(typeParameters);
|
||||
} else {
|
||||
result.add(utils.asTypeElement(type).getQualifiedName());
|
||||
result.add(typeParameters);
|
||||
}
|
||||
} else {
|
||||
Content link = getLink(new HtmlLinkInfo(configuration,
|
||||
HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS, type)
|
||||
.label(configuration.getClassName(utils.asTypeElement(type))));
|
||||
result.add(link);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addClassTree(Content target) {
|
||||
if (!utils.isClass(typeElement)) {
|
||||
return;
|
||||
}
|
||||
target.add(getClassInheritanceTreeContent(typeElement.asType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addParamInfo(Content target) {
|
||||
if (utils.hasBlockTag(typeElement, DocTree.Kind.PARAM)) {
|
||||
var t = configuration.tagletManager.getTaglet(DocTree.Kind.PARAM);
|
||||
Content paramInfo = t.getAllBlockTagOutput(typeElement, getTagletWriterInstance(false));
|
||||
if (!paramInfo.isEmpty()) {
|
||||
target.add(HtmlTree.DL(HtmlStyle.notes, paramInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSubClassInfo(Content target) {
|
||||
if (utils.isClass(typeElement)) {
|
||||
for (String s : suppressSubtypesSet) {
|
||||
if (typeElement.getQualifiedName().contentEquals(s)) {
|
||||
return; // Don't generate the list, too huge
|
||||
}
|
||||
}
|
||||
Set<TypeElement> subclasses = classTree.hierarchy(typeElement).subtypes(typeElement);
|
||||
if (!subclasses.isEmpty()) {
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.subclassesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.PLAIN, subclasses)));
|
||||
target.add(dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSubInterfacesInfo(Content target) {
|
||||
if (utils.isPlainInterface(typeElement)) {
|
||||
Set<TypeElement> subInterfaces = classTree.hierarchy(typeElement).allSubtypes(typeElement);
|
||||
if (!subInterfaces.isEmpty()) {
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.subinterfacesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS, subInterfaces)));
|
||||
target.add(dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterfaceUsageInfo(Content target) {
|
||||
if (!utils.isPlainInterface(typeElement)) {
|
||||
return;
|
||||
}
|
||||
for (String s : suppressImplementingSet) {
|
||||
if (typeElement.getQualifiedName().contentEquals(s)) {
|
||||
return; // Don't generate the list, too huge
|
||||
}
|
||||
}
|
||||
Set<TypeElement> implcl = classTree.implementingClasses(typeElement);
|
||||
if (!implcl.isEmpty()) {
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.implementingClassesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.PLAIN, implcl)));
|
||||
target.add(dl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addImplementedInterfacesInfo(Content target) {
|
||||
SortedSet<TypeMirror> interfaces = new TreeSet<>(comparators.makeTypeMirrorClassUseComparator());
|
||||
interfaces.addAll(utils.getAllInterfaces(typeElement));
|
||||
if (utils.isClass(typeElement) && !interfaces.isEmpty()) {
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.allImplementedInterfacesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS, interfaces)));
|
||||
target.add(dl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSuperInterfacesInfo(Content target) {
|
||||
SortedSet<TypeMirror> interfaces =
|
||||
new TreeSet<>(comparators.makeTypeMirrorIndexUseComparator());
|
||||
interfaces.addAll(utils.getAllInterfaces(typeElement));
|
||||
|
||||
if (utils.isPlainInterface(typeElement) && !interfaces.isEmpty()) {
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.allSuperinterfacesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS, interfaces)));
|
||||
target.add(dl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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) {
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(utils.isPlainInterface(e)
|
||||
? contents.enclosingInterfaceLabel
|
||||
: contents.enclosingClassLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS, List.of(e))));
|
||||
target.add(dl);
|
||||
return null;
|
||||
}
|
||||
}.visit(outerClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionalInterfaceInfo (Content target) {
|
||||
if (isFunctionalInterface()) {
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.functionalInterface));
|
||||
var dd = new HtmlTree(TagName.DD);
|
||||
dd.add(contents.functionalInterfaceMessage);
|
||||
dl.add(dd);
|
||||
target.add(dl);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFunctionalInterface() {
|
||||
List<? extends AnnotationMirror> annotationMirrors = typeElement.getAnnotationMirrors();
|
||||
for (AnnotationMirror anno : annotationMirrors) {
|
||||
if (utils.isFunctionalInterface(anno)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addClassDeprecationInfo(Content classInfo) {
|
||||
List<? extends DeprecatedTree> deprs = utils.getDeprecatedTrees(typeElement);
|
||||
if (utils.isDeprecated(typeElement)) {
|
||||
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);
|
||||
List<? extends DocTree> commentTags = ch.getBody(dt);
|
||||
if (!commentTags.isEmpty()) {
|
||||
addInlineDeprecatedComment(typeElement, deprs.get(0), div);
|
||||
}
|
||||
}
|
||||
classInfo.add(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the links to the given classes.
|
||||
*
|
||||
* @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();
|
||||
boolean isFirst = true;
|
||||
for (Object type : list) {
|
||||
if (!isFirst) {
|
||||
content.add(Text.of(", "));
|
||||
} else {
|
||||
isFirst = false;
|
||||
}
|
||||
// TODO: should we simply split this method up to avoid instanceof ?
|
||||
if (type instanceof TypeElement te) {
|
||||
Content link = getLink(
|
||||
new HtmlLinkInfo(configuration, context, te));
|
||||
content.add(HtmlTree.CODE(link));
|
||||
} else {
|
||||
Content link = getLink(
|
||||
new HtmlLinkInfo(configuration, context, ((TypeMirror)type)));
|
||||
content.add(HtmlTree.CODE(link));
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the TypeElement being documented.
|
||||
*
|
||||
* @return the TypeElement being documented.
|
||||
*/
|
||||
@Override
|
||||
public TypeElement getTypeElement() {
|
||||
return typeElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberDetails(Content content) {
|
||||
var section = HtmlTree.SECTION(HtmlStyle.details, content);
|
||||
// The following id is required by the Navigation bar
|
||||
if (utils.isAnnotationInterface(typeElement)) {
|
||||
section.setId(HtmlIds.ANNOTATION_TYPE_ELEMENT_DETAIL);
|
||||
}
|
||||
return section;
|
||||
}
|
||||
}
|
488
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriter.java
Normal file
488
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriter.java
Normal file
@ -0,0 +1,488 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.Modifier;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.IndexItem;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
|
||||
/**
|
||||
* Write the Constants Summary Page in HTML format.
|
||||
*/
|
||||
public class ConstantsSummaryWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The maximum number of package directories shown in the headings of
|
||||
* the constant values contents list and headings.
|
||||
*/
|
||||
private static final int MAX_CONSTANT_VALUE_INDEX_LENGTH = 2;
|
||||
|
||||
/**
|
||||
* The current class being documented.
|
||||
*/
|
||||
private TypeElement currentTypeElement;
|
||||
|
||||
private final TableHeader constantsTableHeader;
|
||||
|
||||
/**
|
||||
* The HTML tree for constant values summary currently being written.
|
||||
*/
|
||||
private HtmlTree summarySection;
|
||||
|
||||
private final BodyContents bodyContents = new BodyContents();
|
||||
|
||||
private boolean hasConstants = false;
|
||||
|
||||
|
||||
/**
|
||||
* The set of type elements that have constant fields.
|
||||
*/
|
||||
protected final Set<TypeElement> typeElementsWithConstFields;
|
||||
|
||||
/**
|
||||
* The set of package-group headings.
|
||||
*/
|
||||
protected final Set<String> packageGroupHeadings;
|
||||
|
||||
private PackageElement currentPackage;
|
||||
private TypeElement currentClass; // FIXME: dup of currentTypeElement
|
||||
|
||||
|
||||
/**
|
||||
* Construct a ConstantsSummaryWriter.
|
||||
* @param configuration the configuration used in this run
|
||||
* of the standard doclet.
|
||||
*/
|
||||
public ConstantsSummaryWriter(HtmlConfiguration configuration) {
|
||||
super(configuration, DocPaths.CONSTANT_VALUES, false);
|
||||
constantsTableHeader = new TableHeader(
|
||||
contents.modifierAndTypeLabel, contents.constantFieldLabel, contents.valueLabel);
|
||||
|
||||
this.typeElementsWithConstFields = new HashSet<>();
|
||||
this.packageGroupHeadings = new TreeSet<>(utils::compareStrings);
|
||||
}
|
||||
|
||||
public void build() throws DocletException {
|
||||
boolean anyConstants = configuration.packages.stream().anyMatch(this::hasConstantField);
|
||||
if (!anyConstants) {
|
||||
return;
|
||||
}
|
||||
|
||||
configuration.conditionalPages.add(HtmlConfiguration.ConditionalPage.CONSTANT_VALUES);
|
||||
writeGenerating();
|
||||
|
||||
buildConstantSummary();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the constant summary page.
|
||||
*
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
protected void buildConstantSummary() throws DocletException {
|
||||
Content content = getHeader();
|
||||
|
||||
buildContents();
|
||||
buildConstantSummaries();
|
||||
|
||||
addFooter();
|
||||
printDocument(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the list of contents for the groups of packages appearing in the constants summary page.
|
||||
*/
|
||||
protected void buildContents() {
|
||||
Content contentList = getContentsHeader();
|
||||
packageGroupHeadings.clear();
|
||||
for (PackageElement pkg : configuration.packages) {
|
||||
String abbrevPackageName = getAbbrevPackageName(pkg);
|
||||
if (hasConstantField(pkg) && !packageGroupHeadings.contains(abbrevPackageName)) {
|
||||
addLinkToPackageContent(abbrevPackageName, contentList);
|
||||
packageGroupHeadings.add(abbrevPackageName);
|
||||
}
|
||||
}
|
||||
addContentsList(contentList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the summary for each documented package.
|
||||
*/
|
||||
protected void buildConstantSummaries() {
|
||||
packageGroupHeadings.clear();
|
||||
Content summaries = getConstantSummaries();
|
||||
for (PackageElement aPackage : configuration.packages) {
|
||||
if (hasConstantField(aPackage)) {
|
||||
currentPackage = aPackage;
|
||||
//Build the documentation for the current package.
|
||||
buildPackageHeader(summaries);
|
||||
buildClassConstantSummary();
|
||||
}
|
||||
}
|
||||
addConstantSummaries(summaries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the header for the given package.
|
||||
*
|
||||
* @param target the content to which the package header will be added
|
||||
*/
|
||||
protected void buildPackageHeader(Content target) {
|
||||
String abbrevPkgName = getAbbrevPackageName(currentPackage);
|
||||
if (!packageGroupHeadings.contains(abbrevPkgName)) {
|
||||
addPackageGroup(abbrevPkgName, target);
|
||||
packageGroupHeadings.add(abbrevPkgName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the summary for the current class.
|
||||
*/
|
||||
protected void buildClassConstantSummary() {
|
||||
SortedSet<TypeElement> classes = !currentPackage.isUnnamed()
|
||||
? utils.getAllClasses(currentPackage)
|
||||
: configuration.typeElementCatalog.allUnnamedClasses();
|
||||
Content classConstantHeader = getClassConstantHeader();
|
||||
for (TypeElement te : classes) {
|
||||
if (!typeElementsWithConstFields.contains(te) ||
|
||||
!utils.isIncluded(te)) {
|
||||
continue;
|
||||
}
|
||||
currentClass = te;
|
||||
//Build the documentation for the current class.
|
||||
|
||||
buildConstantMembers(classConstantHeader);
|
||||
|
||||
}
|
||||
addClassConstant(classConstantHeader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the summary of constant members in the class.
|
||||
*
|
||||
* @param target the content to which the table of constant members will be added
|
||||
*/
|
||||
protected void buildConstantMembers(Content target) {
|
||||
new ConstantFieldBuilder(currentClass).buildMembersSummary(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return true if the given package has constant fields to document}
|
||||
*
|
||||
* @param pkg the package to be checked
|
||||
*/
|
||||
private boolean hasConstantField(PackageElement pkg) {
|
||||
SortedSet<TypeElement> classes = !pkg.isUnnamed()
|
||||
? utils.getAllClasses(pkg)
|
||||
: configuration.typeElementCatalog.allUnnamedClasses();
|
||||
boolean found = false;
|
||||
for (TypeElement te : classes) {
|
||||
if (utils.isIncluded(te) && hasConstantField(te)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return true if the given class has constant fields to document}
|
||||
*
|
||||
* @param typeElement the class to be checked
|
||||
*/
|
||||
private boolean hasConstantField(TypeElement typeElement) {
|
||||
VisibleMemberTable vmt = configuration.getVisibleMemberTable(typeElement);
|
||||
List<? extends Element> fields = vmt.getVisibleMembers(VisibleMemberTable.Kind.FIELDS);
|
||||
for (Element f : fields) {
|
||||
VariableElement field = (VariableElement)f;
|
||||
if (field.getConstantValue() != null) {
|
||||
typeElementsWithConstFields.add(typeElement);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the abbreviated name for a package, containing the leading segments of the name}
|
||||
*
|
||||
* @param pkg the package
|
||||
*/
|
||||
public String getAbbrevPackageName(PackageElement pkg) {
|
||||
if (pkg.isUnnamed()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String packageName = utils.getPackageName(pkg);
|
||||
int index = -1;
|
||||
for (int j = 0; j < MAX_CONSTANT_VALUE_INDEX_LENGTH; j++) {
|
||||
index = packageName.indexOf(".", index + 1);
|
||||
}
|
||||
return index == -1 ? packageName : packageName.substring(0, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for the table of fields with constant values.
|
||||
*/
|
||||
private class ConstantFieldBuilder {
|
||||
|
||||
/**
|
||||
* The type element that we are examining constants for.
|
||||
*/
|
||||
protected TypeElement typeElement;
|
||||
|
||||
/**
|
||||
* Constructs a {@code ConstantFieldBuilder}.
|
||||
* @param typeElement the type element that we are examining constants for
|
||||
*/
|
||||
public ConstantFieldBuilder(TypeElement typeElement) {
|
||||
this.typeElement = typeElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the table of constants for a given class.
|
||||
*
|
||||
* @param target the content to which the table of class constants will be added
|
||||
*/
|
||||
protected void buildMembersSummary(Content target) {
|
||||
SortedSet<VariableElement> members = members();
|
||||
if (!members.isEmpty()) {
|
||||
addConstantMembers(typeElement, members, target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return a set of visible constant fields for the given type}
|
||||
*/
|
||||
protected SortedSet<VariableElement> members() {
|
||||
VisibleMemberTable vmt = configuration.getVisibleMemberTable(typeElement);
|
||||
List<Element> members = new ArrayList<>();
|
||||
members.addAll(vmt.getVisibleMembers(VisibleMemberTable.Kind.FIELDS));
|
||||
members.addAll(vmt.getVisibleMembers(VisibleMemberTable.Kind.ENUM_CONSTANTS));
|
||||
SortedSet<VariableElement> includes =
|
||||
new TreeSet<>(utils.comparators.makeGeneralPurposeComparator());
|
||||
for (Element element : members) {
|
||||
VariableElement member = (VariableElement)element;
|
||||
if (member.getConstantValue() != null) {
|
||||
includes.add(member);
|
||||
}
|
||||
}
|
||||
return includes;
|
||||
}
|
||||
}
|
||||
|
||||
Content getHeader() {
|
||||
String label = resources.getText("doclet.Constants_Summary");
|
||||
HtmlTree body = getBody(getWindowTitle(label));
|
||||
bodyContents.setHeader(getHeader(PageMode.CONSTANT_VALUES));
|
||||
return body;
|
||||
}
|
||||
|
||||
Content getContentsHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.contentsList);
|
||||
}
|
||||
|
||||
void addLinkToPackageContent(String abbrevPackageName, Content content) {
|
||||
//add link to summary
|
||||
Content link;
|
||||
if (abbrevPackageName.isEmpty()) {
|
||||
link = links.createLink(HtmlIds.UNNAMED_PACKAGE_ANCHOR,
|
||||
contents.defaultPackageLabel, "");
|
||||
} else {
|
||||
Content packageNameContent = Text.of(abbrevPackageName + ".*");
|
||||
link = links.createLink(DocLink.fragment(abbrevPackageName),
|
||||
packageNameContent, "");
|
||||
}
|
||||
content.add(HtmlTree.LI(link));
|
||||
}
|
||||
|
||||
void addContentsList(Content content) {
|
||||
Content titleContent = contents.constantsSummaryTitle;
|
||||
var pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
|
||||
HtmlStyle.title, titleContent);
|
||||
var div = HtmlTree.DIV(HtmlStyle.header, pHeading);
|
||||
bodyContents.addMainContent(div);
|
||||
Content headingContent = contents.contentsHeading;
|
||||
var heading = HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
|
||||
headingContent);
|
||||
var section = HtmlTree.SECTION(HtmlStyle.packages, heading);
|
||||
section.add(content);
|
||||
bodyContents.addMainContent(section);
|
||||
}
|
||||
|
||||
//@Override
|
||||
// TODO: inline?
|
||||
public Content getConstantSummaries() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
void addPackageGroup(String abbrevPackageName, Content toContent) {
|
||||
Content headingContent;
|
||||
HtmlId anchorName;
|
||||
if (abbrevPackageName.isEmpty()) {
|
||||
anchorName = HtmlIds.UNNAMED_PACKAGE_ANCHOR;
|
||||
headingContent = contents.defaultPackageLabel;
|
||||
} else {
|
||||
anchorName = htmlIds.forPackageName(abbrevPackageName);
|
||||
headingContent = new ContentBuilder(
|
||||
getPackageLabel(abbrevPackageName),
|
||||
Text.of(".*"));
|
||||
}
|
||||
var heading = HtmlTree.HEADING_TITLE(
|
||||
Headings.ConstantsSummary.PACKAGE_HEADING,
|
||||
headingContent);
|
||||
summarySection = HtmlTree.SECTION(HtmlStyle.constantsSummary, heading)
|
||||
.setId(anchorName);
|
||||
|
||||
toContent.add(summarySection);
|
||||
}
|
||||
|
||||
Content getClassConstantHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
void addClassConstant(Content fromClassConstant) {
|
||||
summarySection.add(fromClassConstant);
|
||||
hasConstants = true;
|
||||
}
|
||||
|
||||
void addConstantMembers(TypeElement typeElement, Collection<VariableElement> fields,
|
||||
Content target) {
|
||||
currentTypeElement = typeElement;
|
||||
|
||||
//generate links backward only to public classes.
|
||||
Content classLink = (utils.isPublic(typeElement) || utils.isProtected(typeElement)) ?
|
||||
getLink(new HtmlLinkInfo(configuration,
|
||||
HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS_IN_LABEL, typeElement)) :
|
||||
Text.of(utils.getFullyQualifiedName(typeElement));
|
||||
|
||||
PackageElement enclosingPackage = utils.containingPackage(typeElement);
|
||||
Content caption = new ContentBuilder();
|
||||
if (!enclosingPackage.isUnnamed()) {
|
||||
caption.add(enclosingPackage.getQualifiedName());
|
||||
caption.add(".");
|
||||
}
|
||||
caption.add(classLink);
|
||||
|
||||
var table = new Table<Void>(HtmlStyle.summaryTable)
|
||||
.setCaption(caption)
|
||||
.setHeader(constantsTableHeader)
|
||||
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
|
||||
|
||||
for (VariableElement field : fields) {
|
||||
table.addRow(getTypeColumn(field), getNameColumn(field), getValue(field));
|
||||
}
|
||||
target.add(HtmlTree.LI(table));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the type column of the constant table row
|
||||
*/
|
||||
private Content getTypeColumn(VariableElement member) {
|
||||
Content typeContent = new ContentBuilder();
|
||||
var code = new HtmlTree(TagName.CODE)
|
||||
.setId(htmlIds.forMember(currentTypeElement, member));
|
||||
for (Modifier mod : member.getModifiers()) {
|
||||
code.add(Text.of(mod.toString()))
|
||||
.add(Entity.NO_BREAK_SPACE);
|
||||
}
|
||||
Content type = getLink(new HtmlLinkInfo(configuration,
|
||||
HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS, member.asType()));
|
||||
code.add(type);
|
||||
typeContent.add(code);
|
||||
return typeContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the name column of the constant table row
|
||||
*/
|
||||
private Content getNameColumn(VariableElement member) {
|
||||
Content nameContent = getDocLink(HtmlLinkInfo.Kind.PLAIN,
|
||||
member, member.getSimpleName());
|
||||
return HtmlTree.CODE(nameContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the value column of the constant table row
|
||||
*/
|
||||
private Content getValue(VariableElement member) {
|
||||
String value = utils.constantValueExpression(member);
|
||||
return HtmlTree.CODE(Text.of(value));
|
||||
}
|
||||
|
||||
void addConstantSummaries(Content content) {
|
||||
bodyContents.addMainContent(content);
|
||||
}
|
||||
|
||||
void addFooter() {
|
||||
bodyContents.setFooter(getFooter());
|
||||
}
|
||||
|
||||
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,
|
||||
resources.getText("doclet.Constants_Summary"), path));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,260 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.ConstantsSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.IndexItem;
|
||||
|
||||
|
||||
/**
|
||||
* Write the Constants Summary Page in HTML format.
|
||||
*/
|
||||
public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements ConstantsSummaryWriter {
|
||||
|
||||
/**
|
||||
* The current class being documented.
|
||||
*/
|
||||
private TypeElement currentTypeElement;
|
||||
|
||||
private final TableHeader constantsTableHeader;
|
||||
|
||||
/**
|
||||
* The HTML tree for constant values summary currently being written.
|
||||
*/
|
||||
private HtmlTree summarySection;
|
||||
|
||||
private final BodyContents bodyContents = new BodyContents();
|
||||
|
||||
private boolean hasConstants = false;
|
||||
|
||||
/**
|
||||
* Construct a ConstantsSummaryWriter.
|
||||
* @param configuration the configuration used in this run
|
||||
* of the standard doclet.
|
||||
*/
|
||||
public ConstantsSummaryWriterImpl(HtmlConfiguration configuration) {
|
||||
super(configuration, DocPaths.CONSTANT_VALUES);
|
||||
constantsTableHeader = new TableHeader(
|
||||
contents.modifierAndTypeLabel, contents.constantFieldLabel, contents.valueLabel);
|
||||
configuration.conditionalPages.add(HtmlConfiguration.ConditionalPage.CONSTANT_VALUES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getHeader() {
|
||||
String label = resources.getText("doclet.Constants_Summary");
|
||||
HtmlTree body = getBody(getWindowTitle(label));
|
||||
bodyContents.setHeader(getHeader(PageMode.CONSTANT_VALUES));
|
||||
return body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getContentsHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.contentsList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLinkToPackageContent(String abbrevPackageName, Content content) {
|
||||
//add link to summary
|
||||
Content link;
|
||||
if (abbrevPackageName.isEmpty()) {
|
||||
link = links.createLink(HtmlIds.UNNAMED_PACKAGE_ANCHOR,
|
||||
contents.defaultPackageLabel, "");
|
||||
} else {
|
||||
Content packageNameContent = Text.of(abbrevPackageName + ".*");
|
||||
link = links.createLink(DocLink.fragment(abbrevPackageName),
|
||||
packageNameContent, "");
|
||||
}
|
||||
content.add(HtmlTree.LI(link));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentsList(Content content) {
|
||||
Content titleContent = contents.constantsSummaryTitle;
|
||||
var pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
|
||||
HtmlStyle.title, titleContent);
|
||||
var div = HtmlTree.DIV(HtmlStyle.header, pHeading);
|
||||
bodyContents.addMainContent(div);
|
||||
Content headingContent = contents.contentsHeading;
|
||||
var heading = HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
|
||||
headingContent);
|
||||
var section = HtmlTree.SECTION(HtmlStyle.packages, heading);
|
||||
section.add(content);
|
||||
bodyContents.addMainContent(section);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getConstantSummaries() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPackageGroup(String abbrevPackageName, Content toContent) {
|
||||
Content headingContent;
|
||||
HtmlId anchorName;
|
||||
if (abbrevPackageName.isEmpty()) {
|
||||
anchorName = HtmlIds.UNNAMED_PACKAGE_ANCHOR;
|
||||
headingContent = contents.defaultPackageLabel;
|
||||
} else {
|
||||
anchorName = htmlIds.forPackageName(abbrevPackageName);
|
||||
headingContent = new ContentBuilder(
|
||||
getPackageLabel(abbrevPackageName),
|
||||
Text.of(".*"));
|
||||
}
|
||||
var heading = HtmlTree.HEADING_TITLE(
|
||||
Headings.ConstantsSummary.PACKAGE_HEADING,
|
||||
headingContent);
|
||||
summarySection = HtmlTree.SECTION(HtmlStyle.constantsSummary, heading)
|
||||
.setId(anchorName);
|
||||
|
||||
toContent.add(summarySection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getClassConstantHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addClassConstant(Content fromClassConstant) {
|
||||
summarySection.add(fromClassConstant);
|
||||
hasConstants = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConstantMembers(TypeElement typeElement, Collection<VariableElement> fields,
|
||||
Content target) {
|
||||
currentTypeElement = typeElement;
|
||||
|
||||
//generate links backward only to public classes.
|
||||
Content classLink = (utils.isPublic(typeElement) || utils.isProtected(typeElement)) ?
|
||||
getLink(new HtmlLinkInfo(configuration,
|
||||
HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS_IN_LABEL, typeElement)) :
|
||||
Text.of(utils.getFullyQualifiedName(typeElement));
|
||||
|
||||
PackageElement enclosingPackage = utils.containingPackage(typeElement);
|
||||
Content caption = new ContentBuilder();
|
||||
if (!enclosingPackage.isUnnamed()) {
|
||||
caption.add(enclosingPackage.getQualifiedName());
|
||||
caption.add(".");
|
||||
}
|
||||
caption.add(classLink);
|
||||
|
||||
var table = new Table<Void>(HtmlStyle.summaryTable)
|
||||
.setCaption(caption)
|
||||
.setHeader(constantsTableHeader)
|
||||
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
|
||||
|
||||
for (VariableElement field : fields) {
|
||||
table.addRow(getTypeColumn(field), getNameColumn(field), getValue(field));
|
||||
}
|
||||
target.add(HtmlTree.LI(table));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the type column of the constant table row
|
||||
*/
|
||||
private Content getTypeColumn(VariableElement member) {
|
||||
Content typeContent = new ContentBuilder();
|
||||
var code = new HtmlTree(TagName.CODE)
|
||||
.setId(htmlIds.forMember(currentTypeElement, member));
|
||||
for (Modifier mod : member.getModifiers()) {
|
||||
code.add(Text.of(mod.toString()))
|
||||
.add(Entity.NO_BREAK_SPACE);
|
||||
}
|
||||
Content type = getLink(new HtmlLinkInfo(configuration,
|
||||
HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS, member.asType()));
|
||||
code.add(type);
|
||||
typeContent.add(code);
|
||||
return typeContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the name column of the constant table row
|
||||
*/
|
||||
private Content getNameColumn(VariableElement member) {
|
||||
Content nameContent = getDocLink(HtmlLinkInfo.Kind.PLAIN,
|
||||
member, member.getSimpleName());
|
||||
return HtmlTree.CODE(nameContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the value column of the constant table row
|
||||
*/
|
||||
private Content getValue(VariableElement member) {
|
||||
String value = utils.constantValueExpression(member);
|
||||
return HtmlTree.CODE(Text.of(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConstantSummaries(Content content) {
|
||||
bodyContents.addMainContent(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFooter() {
|
||||
bodyContents.setFooter(getFooter());
|
||||
}
|
||||
|
||||
@Override
|
||||
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,
|
||||
resources.getText("doclet.Constants_Summary"), path));
|
||||
}
|
||||
}
|
||||
}
|
@ -39,19 +39,20 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.ConstructorWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind.CONSTRUCTORS;
|
||||
|
||||
|
||||
/**
|
||||
* Writes constructor documentation.
|
||||
*/
|
||||
public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
implements ConstructorWriter, MemberSummaryWriter {
|
||||
public class ConstructorWriter extends AbstractExecutableMemberWriter {
|
||||
|
||||
/**
|
||||
* The current constructor that is being documented at this point in time.
|
||||
*/
|
||||
private ExecutableElement currentConstructor;
|
||||
|
||||
private boolean foundNonPubConstructor = false;
|
||||
|
||||
@ -59,14 +60,12 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
* Construct a new ConstructorWriterImpl.
|
||||
*
|
||||
* @param writer The writer for the class that the constructors belong to.
|
||||
* @param typeElement the class being documented.
|
||||
*/
|
||||
public ConstructorWriterImpl(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
|
||||
VisibleMemberTable vmt = configuration.getVisibleMemberTable(typeElement);
|
||||
List<? extends Element> constructors = vmt.getVisibleMembers(CONSTRUCTORS);
|
||||
public ConstructorWriter(ClassWriter writer) {
|
||||
super(writer, writer.getTypeElement());
|
||||
|
||||
// the following must be done before the summary table is generated
|
||||
var constructors = getVisibleMembers(VisibleMemberTable.Kind.CONSTRUCTORS);
|
||||
for (Element constructor : constructors) {
|
||||
if (utils.isProtected(constructor) || utils.isPrivate(constructor)) {
|
||||
setFoundNonPubConstructor(true);
|
||||
@ -79,10 +78,96 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
*
|
||||
* @param writer The writer for the class that the constructors belong to.
|
||||
*/
|
||||
public ConstructorWriterImpl(SubWriterHolderWriter writer) {
|
||||
public ConstructorWriter(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
public void build(Content target) throws DocletException {
|
||||
buildConstructorDoc(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the constructor documentation.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildConstructorDoc(Content target) {
|
||||
var constructors = getVisibleMembers(VisibleMemberTable.Kind.CONSTRUCTORS);
|
||||
if (!constructors.isEmpty()) {
|
||||
for (Element constructor : constructors) {
|
||||
if (utils.isProtected(constructor) || utils.isPrivate(constructor)) {
|
||||
setFoundNonPubConstructor(true);
|
||||
}
|
||||
}
|
||||
|
||||
Content constructorDetailsHeader = getConstructorDetailsHeader(target);
|
||||
Content memberList = getMemberList();
|
||||
|
||||
for (Element constructor : constructors) {
|
||||
currentConstructor = (ExecutableElement)constructor;
|
||||
Content constructorContent = getConstructorHeaderContent(currentConstructor);
|
||||
|
||||
buildSignature(constructorContent);
|
||||
buildDeprecationInfo(constructorContent);
|
||||
buildPreviewInfo(constructorContent);
|
||||
buildConstructorComments(constructorContent);
|
||||
buildTagInfo(constructorContent);
|
||||
|
||||
memberList.add(getMemberListItem(constructorContent));
|
||||
}
|
||||
Content constructorDetails = getConstructorDetails(constructorDetailsHeader, memberList);
|
||||
target.add(constructorDetails);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature.
|
||||
*
|
||||
* @param constructorContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildSignature(Content constructorContent) {
|
||||
constructorContent.add(getSignature(currentConstructor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the deprecation information.
|
||||
*
|
||||
* @param constructorContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildDeprecationInfo(Content constructorContent) {
|
||||
addDeprecated(currentConstructor, constructorContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the preview information.
|
||||
*
|
||||
* @param constructorContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPreviewInfo(Content constructorContent) {
|
||||
addPreview(currentConstructor, constructorContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the comments for the constructor. Do nothing if
|
||||
* {@link BaseOptions#noComment()} is set to true.
|
||||
*
|
||||
* @param constructorContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildConstructorComments(Content constructorContent) {
|
||||
if (!options.noComment()) {
|
||||
addComments(currentConstructor, constructorContent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information.
|
||||
*
|
||||
* @param constructorContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildTagInfo(Content constructorContent) {
|
||||
addTags(currentConstructor, constructorContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberSummaryHeader(TypeElement typeElement,
|
||||
Content content) {
|
||||
@ -98,8 +183,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
HtmlIds.CONSTRUCTOR_SUMMARY, summariesList, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getConstructorDetailsHeader(Content content) {
|
||||
protected Content getConstructorDetailsHeader(Content content) {
|
||||
content.add(MarkerComments.START_OF_CONSTRUCTOR_DETAILS);
|
||||
Content constructorDetails = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
|
||||
@ -108,8 +192,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
return constructorDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getConstructorHeaderContent(ExecutableElement constructor) {
|
||||
protected Content getConstructorHeaderContent(ExecutableElement constructor) {
|
||||
Content content = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
|
||||
Text.of(name(constructor)));
|
||||
@ -122,8 +205,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
.setId(htmlIds.forMember(constructor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSignature(ExecutableElement constructor) {
|
||||
protected Content getSignature(ExecutableElement constructor) {
|
||||
return new Signatures.MemberSignature(constructor, this)
|
||||
.setParameters(getParameters(constructor, true))
|
||||
.setExceptions(getExceptions(constructor))
|
||||
@ -131,28 +213,23 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
.toContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeprecated(ExecutableElement constructor, Content constructorContent) {
|
||||
protected void addDeprecated(ExecutableElement constructor, Content constructorContent) {
|
||||
addDeprecatedInfo(constructor, constructorContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPreview(ExecutableElement constructor, Content content) {
|
||||
protected void addPreview(ExecutableElement constructor, Content content) {
|
||||
addPreviewInfo(constructor, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComments(ExecutableElement constructor, Content constructorContent) {
|
||||
protected void addComments(ExecutableElement constructor, Content constructorContent) {
|
||||
addComment(constructor, constructorContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(ExecutableElement constructor, Content constructorContent) {
|
||||
protected void addTags(ExecutableElement constructor, Content constructorContent) {
|
||||
writer.addTagsInfo(constructor, constructorContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getConstructorDetails(Content memberDetailsHeader, Content memberDetails) {
|
||||
protected Content getConstructorDetails(Content memberDetailsHeader, Content memberDetails) {
|
||||
return writer.getDetailsListItem(
|
||||
HtmlTree.SECTION(HtmlStyle.constructorDetails)
|
||||
.setId(HtmlIds.CONSTRUCTOR_DETAIL)
|
||||
@ -160,8 +237,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
.add(memberDetails));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFoundNonPubConstructor(boolean foundNonPubConstructor) {
|
||||
protected void setFoundNonPubConstructor(boolean foundNonPubConstructor) {
|
||||
this.foundNonPubConstructor = foundNonPubConstructor;
|
||||
}
|
||||
|
||||
@ -222,8 +298,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberHeader(){
|
||||
protected Content getMemberHeader(){
|
||||
return writer.getMemberHeader();
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
@ -34,7 +34,6 @@ import java.util.regex.Pattern;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
@ -393,7 +392,7 @@ public class Contents {
|
||||
*/
|
||||
public Content getContent(String key, Object o0, Object o1, Object o2) {
|
||||
Content c = new ContentBuilder();
|
||||
Pattern p = Pattern.compile("\\{([012])\\}");
|
||||
Pattern p = Pattern.compile("\\{([012])}");
|
||||
String text = resources.getText(key); // TODO: cache
|
||||
Matcher m = p.matcher(text);
|
||||
int start = 0;
|
||||
|
@ -36,7 +36,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
@ -31,9 +31,7 @@ import com.sun.source.doctree.StartElementTree;
|
||||
import com.sun.source.util.DocTreeFactory;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocFileElement;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
@ -54,7 +52,7 @@ import java.util.List;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
|
||||
public class DocFilesHandlerImpl implements DocFilesHandler {
|
||||
public class DocFilesHandler {
|
||||
|
||||
public final Element element;
|
||||
public final Location location;
|
||||
@ -69,7 +67,7 @@ public class DocFilesHandlerImpl implements DocFilesHandler {
|
||||
* @param element the containing element of the doc-files.
|
||||
*
|
||||
*/
|
||||
public DocFilesHandlerImpl(HtmlConfiguration configuration, Element element) {
|
||||
public DocFilesHandler(HtmlConfiguration configuration, Element element) {
|
||||
this.configuration = configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.element = element;
|
||||
@ -102,7 +100,6 @@ public class DocFilesHandlerImpl implements DocFilesHandler {
|
||||
* @throws DocFileIOException if there is a problem while copying
|
||||
* the documentation files
|
||||
*/
|
||||
@Override
|
||||
public void copyDocFiles() throws DocFileIOException {
|
||||
boolean first = true;
|
||||
for (DocFile srcdir : DocFile.list(configuration, location, source)) {
|
||||
@ -119,7 +116,6 @@ public class DocFilesHandlerImpl implements DocFilesHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DocPath> getStylesheets() throws DocFileIOException {
|
||||
var stylesheets = new ArrayList<DocPath>();
|
||||
for (DocFile srcdir : DocFile.list(configuration, location, source)) {
|
@ -25,7 +25,6 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
@ -34,24 +33,110 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.EnumConstantWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
/**
|
||||
* Writes enum constant documentation in HTML format.
|
||||
*/
|
||||
public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
implements EnumConstantWriter, MemberSummaryWriter {
|
||||
public class EnumConstantWriter extends AbstractMemberWriter {
|
||||
|
||||
public EnumConstantWriterImpl(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
/**
|
||||
* The current enum constant that is being documented.
|
||||
*/
|
||||
private VariableElement currentElement;
|
||||
|
||||
public EnumConstantWriter(ClassWriter classWriter) {
|
||||
super(classWriter, classWriter.typeElement);
|
||||
}
|
||||
|
||||
public EnumConstantWriterImpl(SubWriterHolderWriter writer) {
|
||||
public EnumConstantWriter(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
public void build(Content target) {
|
||||
buildEnumConstant(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the enum constant documentation.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildEnumConstant(Content target) {
|
||||
var enumConstants = getVisibleMembers(VisibleMemberTable.Kind.ENUM_CONSTANTS);
|
||||
if (!enumConstants.isEmpty()) {
|
||||
Content enumConstantsDetailsHeader = getEnumConstantsDetailsHeader(typeElement,
|
||||
target);
|
||||
Content memberList = getMemberList();
|
||||
|
||||
for (Element enumConstant : enumConstants) {
|
||||
currentElement = (VariableElement)enumConstant;
|
||||
Content enumConstantContent = getEnumConstantsHeader(currentElement,
|
||||
memberList);
|
||||
|
||||
buildSignature(enumConstantContent);
|
||||
buildDeprecationInfo(enumConstantContent);
|
||||
buildPreviewInfo(enumConstantContent);
|
||||
buildEnumConstantComments(enumConstantContent);
|
||||
buildTagInfo(enumConstantContent);
|
||||
|
||||
memberList.add(getMemberListItem(enumConstantContent));
|
||||
}
|
||||
Content enumConstantDetails = getEnumConstantsDetails(
|
||||
enumConstantsDetailsHeader, memberList);
|
||||
target.add(enumConstantDetails);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildSignature(Content target) {
|
||||
target.add(getSignature(currentElement));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the deprecation information.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildDeprecationInfo(Content target) {
|
||||
addDeprecated(currentElement, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the preview information.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPreviewInfo(Content target) {
|
||||
addPreview(currentElement, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the comments for the enum constant. Do nothing if
|
||||
* {@link BaseOptions#noComment()} is set to true.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildEnumConstantComments(Content target) {
|
||||
if (!options.noComment()) {
|
||||
addComments(currentElement, target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildTagInfo(Content target) {
|
||||
addTags(currentElement, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberSummaryHeader(TypeElement typeElement,
|
||||
Content content) {
|
||||
@ -67,8 +152,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
HtmlIds.ENUM_CONSTANT_SUMMARY, summariesList, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getEnumConstantsDetailsHeader(TypeElement typeElement,
|
||||
protected Content getEnumConstantsDetailsHeader(TypeElement typeElement,
|
||||
Content memberDetails) {
|
||||
memberDetails.add(MarkerComments.START_OF_ENUM_CONSTANT_DETAILS);
|
||||
var enumConstantsDetailsContent = new ContentBuilder();
|
||||
@ -78,8 +162,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
return enumConstantsDetailsContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getEnumConstantsHeader(VariableElement enumConstant,
|
||||
protected Content getEnumConstantsHeader(VariableElement enumConstant,
|
||||
Content enumConstantsDetails) {
|
||||
Content enumConstantsContent = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
|
||||
@ -89,36 +172,30 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
.setId(htmlIds.forMember(enumConstant));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSignature(VariableElement enumConstant) {
|
||||
protected Content getSignature(VariableElement enumConstant) {
|
||||
return new Signatures.MemberSignature(enumConstant, this)
|
||||
.setType(enumConstant.asType())
|
||||
.setAnnotations(writer.getAnnotationInfo(enumConstant, true))
|
||||
.toContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeprecated(VariableElement enumConstant, Content content) {
|
||||
protected void addDeprecated(VariableElement enumConstant, Content content) {
|
||||
addDeprecatedInfo(enumConstant, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPreview(VariableElement enumConstant, Content content) {
|
||||
protected void addPreview(VariableElement enumConstant, Content content) {
|
||||
addPreviewInfo(enumConstant, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComments(VariableElement enumConstant, Content enumConstants) {
|
||||
protected void addComments(VariableElement enumConstant, Content enumConstants) {
|
||||
addComment(enumConstant, enumConstants);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(VariableElement enumConstant, Content content) {
|
||||
protected void addTags(VariableElement enumConstant, Content content) {
|
||||
writer.addTagsInfo(enumConstant, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getEnumConstantsDetails(Content memberDetailsHeader,
|
||||
protected Content getEnumConstantsDetails(Content memberDetailsHeader,
|
||||
Content content) {
|
||||
return writer.getDetailsListItem(
|
||||
HtmlTree.SECTION(HtmlStyle.constantDetails)
|
||||
@ -175,8 +252,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
return writer.getDocLink(HtmlLinkInfo.Kind.SHOW_PREVIEW, member, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberHeader(){
|
||||
protected Content getMemberHeader(){
|
||||
return writer.getMemberHeader();
|
||||
}
|
||||
}
|
@ -53,7 +53,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletElement;
|
||||
import jdk.javadoc.internal.doclets.toolkit.OverviewElement;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
@ -247,34 +246,31 @@ public class ExternalSpecsWriter extends HtmlDocletWriter {
|
||||
|
||||
Comparator<String> getTitleComparator() {
|
||||
Collator collator = Collator.getInstance();
|
||||
return new Comparator<>() {
|
||||
@Override
|
||||
public int compare(String s1, String s2) {
|
||||
int i1 = 0;
|
||||
int i2 = 0;
|
||||
while (i1 < s1.length() && i2 < s2.length()) {
|
||||
int j1 = find(s1, i1, Character::isDigit);
|
||||
int j2 = find(s2, i2, Character::isDigit);
|
||||
int cmp = collator.compare(s1.substring(i1, j1), s2.substring(i2, j2));
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
if (j1 == s1.length() || j2 == s2.length()) {
|
||||
i1 = j1;
|
||||
i2 = j2;
|
||||
break;
|
||||
}
|
||||
int k1 = find(s1, j1, ch -> !Character.isDigit(ch));
|
||||
int k2 = find(s2, j2, ch -> !Character.isDigit(ch));
|
||||
cmp = Integer.compare(Integer.parseInt(s1.substring(j1, k1)), Integer.parseInt(s2.substring(j2, k2)));
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
i1 = k1;
|
||||
i2 = k2;
|
||||
return (s1, s2) -> {
|
||||
int i1 = 0;
|
||||
int i2 = 0;
|
||||
while (i1 < s1.length() && i2 < s2.length()) {
|
||||
int j1 = find(s1, i1, Character::isDigit);
|
||||
int j2 = find(s2, i2, Character::isDigit);
|
||||
int cmp = collator.compare(s1.substring(i1, j1), s2.substring(i2, j2));
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
return i1 < s1.length() ? 1 : i2 < s2.length() ? -1 : 0;
|
||||
if (j1 == s1.length() || j2 == s2.length()) {
|
||||
i1 = j1;
|
||||
i2 = j2;
|
||||
break;
|
||||
}
|
||||
int k1 = find(s1, j1, ch -> !Character.isDigit(ch));
|
||||
int k2 = find(s2, j2, ch -> !Character.isDigit(ch));
|
||||
cmp = Integer.compare(Integer.parseInt(s1.substring(j1, k1)), Integer.parseInt(s2.substring(j2, k2)));
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
i1 = k1;
|
||||
i2 = k2;
|
||||
}
|
||||
return i1 < s1.length() ? 1 : i2 < s2.length() ? -1 : 0;
|
||||
};
|
||||
}
|
||||
|
||||
@ -292,8 +288,7 @@ public class ExternalSpecsWriter extends HtmlDocletWriter {
|
||||
if (element instanceof OverviewElement) {
|
||||
return links.createLink(pathToRoot.resolve(i.getUrl()),
|
||||
resources.getText("doclet.Overview"));
|
||||
} else if (element instanceof DocletElement) {
|
||||
DocletElement e = (DocletElement) element;
|
||||
} else if (element instanceof DocletElement e) {
|
||||
// Implementations of DocletElement do not override equals and
|
||||
// hashCode; putting instances of DocletElement in a map is not
|
||||
// incorrect, but might well be inefficient
|
||||
|
@ -37,24 +37,115 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.FieldWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
/**
|
||||
* Writes field documentation in HTML format.
|
||||
*/
|
||||
public class FieldWriterImpl extends AbstractMemberWriter
|
||||
implements FieldWriter, MemberSummaryWriter {
|
||||
public class FieldWriter extends AbstractMemberWriter {
|
||||
|
||||
public FieldWriterImpl(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
/**
|
||||
* The index of the current field that is being documented at this point
|
||||
* in time.
|
||||
*/
|
||||
private VariableElement currentElement;
|
||||
|
||||
public FieldWriter(ClassWriter writer) {
|
||||
super(writer, writer.typeElement);
|
||||
}
|
||||
|
||||
public FieldWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
}
|
||||
|
||||
public FieldWriterImpl(SubWriterHolderWriter writer) {
|
||||
// used in ClassUseWriter and SummaryUseWriter
|
||||
public FieldWriter(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
public void build(Content target) throws DocletException {
|
||||
buildFieldDoc(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the field documentation.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildFieldDoc(Content target) {
|
||||
var fields = getVisibleMembers(VisibleMemberTable.Kind.FIELDS);
|
||||
if (!fields.isEmpty()) {
|
||||
Content fieldDetailsHeader = getFieldDetailsHeader(target);
|
||||
Content memberList = getMemberList();
|
||||
|
||||
for (Element element : fields) {
|
||||
currentElement = (VariableElement)element;
|
||||
Content fieldContent = getFieldHeaderContent(currentElement);
|
||||
|
||||
buildSignature(fieldContent);
|
||||
buildDeprecationInfo(fieldContent);
|
||||
buildPreviewInfo(fieldContent);
|
||||
buildFieldComments(fieldContent);
|
||||
buildTagInfo(fieldContent);
|
||||
|
||||
memberList.add(getMemberListItem(fieldContent));
|
||||
}
|
||||
Content fieldDetails = getFieldDetails(fieldDetailsHeader, memberList);
|
||||
target.add(fieldDetails);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature.
|
||||
*
|
||||
* @param fieldContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildSignature(Content fieldContent) {
|
||||
fieldContent.add(getSignature(currentElement));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the deprecation information.
|
||||
*
|
||||
* @param fieldContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildDeprecationInfo(Content fieldContent) {
|
||||
addDeprecated(currentElement, fieldContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the preview information.
|
||||
*
|
||||
* @param fieldContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPreviewInfo(Content fieldContent) {
|
||||
addPreview(currentElement, fieldContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the comments for the field. Do nothing if
|
||||
* {@link BaseOptions#noComment()} is set to true.
|
||||
*
|
||||
* @param fieldContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildFieldComments(Content fieldContent) {
|
||||
if (!options.noComment()) {
|
||||
addComments(currentElement, fieldContent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information.
|
||||
*
|
||||
* @param fieldContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildTagInfo(Content fieldContent) {
|
||||
addTags(currentElement, fieldContent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Content getMemberSummaryHeader(TypeElement typeElement,
|
||||
Content content) {
|
||||
@ -70,8 +161,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
HtmlIds.FIELD_SUMMARY, summariesList, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getFieldDetailsHeader(Content content) {
|
||||
protected Content getFieldDetailsHeader(Content content) {
|
||||
content.add(MarkerComments.START_OF_FIELD_DETAILS);
|
||||
Content fieldDetailsContent = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
|
||||
@ -80,8 +170,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
return fieldDetailsContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getFieldHeaderContent(VariableElement field) {
|
||||
protected Content getFieldHeaderContent(VariableElement field) {
|
||||
Content content = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
|
||||
Text.of(name(field)));
|
||||
@ -90,38 +179,32 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
.setId(htmlIds.forMember(field));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSignature(VariableElement field) {
|
||||
protected Content getSignature(VariableElement field) {
|
||||
return new Signatures.MemberSignature(field, this)
|
||||
.setType(utils.asInstantiatedFieldType(typeElement, field))
|
||||
.setAnnotations(writer.getAnnotationInfo(field, true))
|
||||
.toContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeprecated(VariableElement field, Content fieldContent) {
|
||||
protected void addDeprecated(VariableElement field, Content fieldContent) {
|
||||
addDeprecatedInfo(field, fieldContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPreview(VariableElement field, Content content) {
|
||||
protected void addPreview(VariableElement field, Content content) {
|
||||
addPreviewInfo(field, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComments(VariableElement field, Content fieldContent) {
|
||||
protected void addComments(VariableElement field, Content fieldContent) {
|
||||
if (!utils.getFullBody(field).isEmpty()) {
|
||||
writer.addInlineComment(field, fieldContent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(VariableElement field, Content fieldContent) {
|
||||
protected void addTags(VariableElement field, Content fieldContent) {
|
||||
writer.addTagsInfo(field, fieldContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getFieldDetails(Content memberDetailsHeaderContent, Content memberContent) {
|
||||
protected Content getFieldDetails(Content memberDetailsHeaderContent, Content memberContent) {
|
||||
return writer.getDetailsListItem(
|
||||
HtmlTree.SECTION(HtmlStyle.fieldDetails)
|
||||
.setId(HtmlIds.FIELD_DETAIL)
|
||||
@ -201,8 +284,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
return writer.getDocLink(HtmlLinkInfo.Kind.SHOW_PREVIEW, member, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberHeader(){
|
||||
protected Content getMemberHeader(){
|
||||
return writer.getMemberHeader();
|
||||
}
|
||||
}
|
@ -36,7 +36,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
@ -34,6 +34,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@ -61,7 +62,6 @@ import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
@ -183,6 +183,11 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
*/
|
||||
private ZonedDateTime buildDate;
|
||||
|
||||
/**
|
||||
* The set of packages for which we have copied the doc files.
|
||||
*/
|
||||
private Set<PackageElement> containingPackagesSeen;
|
||||
|
||||
/**
|
||||
* Constructs the full configuration needed by the doclet, including
|
||||
* the format-specific part, defined in this class, and the format-independent
|
||||
@ -220,6 +225,7 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
|
||||
messages = new Messages(this, msgResources);
|
||||
options = new HtmlOptions(this);
|
||||
containingPackagesSeen = new HashSet<>();
|
||||
|
||||
Runtime.Version v;
|
||||
try {
|
||||
@ -271,6 +277,15 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the packages for which we have copied the doc files}
|
||||
*
|
||||
* @see {@link ClassWriter#copyDocFiles()}
|
||||
*/
|
||||
public Set<PackageElement> getContainingPackagesSeen() {
|
||||
return containingPackagesSeen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finishOptionSettings() {
|
||||
if (!options.validateOptions()) {
|
||||
@ -365,9 +380,9 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WriterFactory getWriterFactory() {
|
||||
return new WriterFactoryImpl(this);
|
||||
// TODO: this is called many times: why not create and use a single instance?
|
||||
return new WriterFactory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,8 +51,6 @@ import jdk.javadoc.doclet.Reporter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
@ -213,7 +211,11 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
protected void generateOtherFiles(ClassTree classTree)
|
||||
throws DocletException {
|
||||
super.generateOtherFiles(classTree);
|
||||
HtmlOptions options = configuration.getOptions();
|
||||
|
||||
new ConstantsSummaryWriter(configuration).build();
|
||||
new SerializedFormWriter(configuration).build();
|
||||
|
||||
var options = configuration.getOptions();
|
||||
if (options.linkSource()) {
|
||||
SourceToHTMLConverter.convertRoot(configuration, DocPaths.SOURCE_OUTPUT);
|
||||
}
|
||||
@ -323,7 +325,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
protected void generateFiles() throws DocletException {
|
||||
super.generateFiles();
|
||||
|
||||
if (configuration.tagletManager != null) { // may be null, if no files generated, perhaps because of errros
|
||||
if (configuration.tagletManager != null) { // may be null, if no files generated, perhaps because of errors
|
||||
configuration.tagletManager.printReport();
|
||||
}
|
||||
|
||||
@ -388,13 +390,12 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
@Override // defined by AbstractDoclet
|
||||
protected void generateClassFiles(SortedSet<TypeElement> typeElems, ClassTree classTree)
|
||||
throws DocletException {
|
||||
BuilderFactory f = configuration.getBuilderFactory();
|
||||
for (TypeElement te : typeElems) {
|
||||
if (utils.hasHiddenTag(te) ||
|
||||
!(configuration.isGeneratedDoc(te) && utils.isIncluded(te))) {
|
||||
continue;
|
||||
}
|
||||
f.getClassBuilder(te, classTree).build();
|
||||
new ClassWriter(configuration, te, classTree).build();
|
||||
}
|
||||
}
|
||||
|
||||
@ -403,9 +404,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
if (configuration.showModules) {
|
||||
List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet());
|
||||
for (ModuleElement mdle : mdles) {
|
||||
AbstractBuilder moduleSummaryBuilder =
|
||||
configuration.getBuilderFactory().getModuleSummaryBuilder(mdle);
|
||||
moduleSummaryBuilder.build();
|
||||
new ModuleWriter(configuration, mdle).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -420,9 +419,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
// deprecated, do not generate the package-summary.html, package-frame.html
|
||||
// and package-tree.html pages for that package.
|
||||
if (!(options.noDeprecated() && utils.isDeprecated(pkg))) {
|
||||
AbstractBuilder packageSummaryBuilder =
|
||||
configuration.getBuilderFactory().getPackageSummaryBuilder(pkg);
|
||||
packageSummaryBuilder.build();
|
||||
new PackageWriter(configuration, pkg).build();
|
||||
if (options.createTree()) {
|
||||
PackageTreeWriter.generate(configuration, pkg, options.noDeprecated());
|
||||
}
|
||||
|
@ -92,7 +92,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.formats.html.taglets.Taglet;
|
||||
import jdk.javadoc.internal.doclets.formats.html.taglets.TagletWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
@ -199,6 +198,16 @@ public class HtmlDocletWriter {
|
||||
* @param path the file to be generated.
|
||||
*/
|
||||
public HtmlDocletWriter(HtmlConfiguration configuration, DocPath path) {
|
||||
this(configuration, path, true);
|
||||
}
|
||||
/**
|
||||
* Creates an {@code HtmlDocletWriter}.
|
||||
*
|
||||
* @param configuration the configuration for this doclet
|
||||
* @param path the file to be generated.
|
||||
* @param generating whether to write a "Geneterating ..." message to the console
|
||||
*/
|
||||
public HtmlDocletWriter(HtmlConfiguration configuration, DocPath path, boolean generating) {
|
||||
this.configuration = configuration;
|
||||
this.options = configuration.getOptions();
|
||||
this.contents = configuration.getContents();
|
||||
@ -214,8 +223,17 @@ public class HtmlDocletWriter {
|
||||
this.docPaths = configuration.docPaths;
|
||||
this.mainBodyScript = new Script();
|
||||
|
||||
if (generating) {
|
||||
writeGenerating();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a "Generating _file_" message to the console
|
||||
*/
|
||||
protected final void writeGenerating() {
|
||||
messages.notice("doclet.Generating_0",
|
||||
DocFile.createFileForOutput(configuration, path).getPath());
|
||||
DocFile.createFileForOutput(configuration, path).getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -300,10 +318,10 @@ public class HtmlDocletWriter {
|
||||
// for these methods:
|
||||
// * ForkJoinPool.execute(java.lang.Runnable)
|
||||
// This is a long-standing bug, which must be fixed separately: JDK-8302316
|
||||
MethodWriterImpl.addImplementsInfo(this, method, implementedMethods, dl);
|
||||
MethodWriter.addImplementsInfo(this, method, implementedMethods, dl);
|
||||
}
|
||||
if (overrideInfo != null) {
|
||||
MethodWriterImpl.addOverridden(this,
|
||||
MethodWriter.addOverridden(this,
|
||||
overrideInfo.overriddenMethodOwner(),
|
||||
overrideInfo.overriddenMethod(),
|
||||
dl);
|
||||
@ -1476,9 +1494,9 @@ public class HtmlDocletWriter {
|
||||
// in their respective writers, but other uses of the method are only interested in TypeElements.
|
||||
Element currentPageElement = getCurrentPageElement();
|
||||
if (currentPageElement == null) {
|
||||
if (this instanceof PackageWriterImpl packageWriter) {
|
||||
if (this instanceof PackageWriter packageWriter) {
|
||||
currentPageElement = packageWriter.packageElement;
|
||||
} else if (this instanceof ModuleWriterImpl moduleWriter) {
|
||||
} else if (this instanceof ModuleWriter moduleWriter) {
|
||||
currentPageElement = moduleWriter.mdle;
|
||||
}
|
||||
}
|
||||
@ -1511,7 +1529,7 @@ public class HtmlDocletWriter {
|
||||
* element of this writer.
|
||||
*/
|
||||
private boolean inSamePackage(Element element) {
|
||||
Element currentPageElement = (this instanceof PackageWriterImpl packageWriter)
|
||||
Element currentPageElement = (this instanceof PackageWriter packageWriter)
|
||||
? packageWriter.packageElement : getCurrentPageElement();
|
||||
return currentPageElement != null && !utils.isModule(element)
|
||||
&& Objects.equals(utils.containingPackage(currentPageElement),
|
||||
@ -2018,8 +2036,7 @@ public class HtmlDocletWriter {
|
||||
private List<DocPath> getStylesheets(Element element) throws DocFileIOException {
|
||||
List<DocPath> localStylesheets = configuration.localStylesheetMap.get(element);
|
||||
if (localStylesheets == null) {
|
||||
DocFilesHandlerImpl docFilesHandler = (DocFilesHandlerImpl)configuration
|
||||
.getWriterFactory().getDocFilesHandler(element);
|
||||
DocFilesHandler docFilesHandler = configuration.getWriterFactory().getDocFilesHandler(element);
|
||||
localStylesheets = docFilesHandler.getStylesheets();
|
||||
configuration.localStylesheetMap.put(element, localStylesheets);
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
@ -35,7 +35,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
|
||||
@ -77,7 +76,7 @@ public class HtmlLinkInfo {
|
||||
/**
|
||||
* Link with optional type parameters and bounds rendered as separate links.
|
||||
*/
|
||||
LINK_TYPE_PARAMS_AND_BOUNDS;
|
||||
LINK_TYPE_PARAMS_AND_BOUNDS
|
||||
}
|
||||
|
||||
private final HtmlConfiguration configuration;
|
||||
|
@ -36,7 +36,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Script;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
@ -46,7 +46,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
@ -26,6 +26,7 @@
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@ -40,25 +41,39 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MethodWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
/**
|
||||
* Writes method documentation in HTML format.
|
||||
*/
|
||||
public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
implements MethodWriter, MemberSummaryWriter {
|
||||
public class MethodWriter extends AbstractExecutableMemberWriter {
|
||||
|
||||
/**
|
||||
* The index of the current field that is being documented at this point
|
||||
* in time.
|
||||
*/
|
||||
private ExecutableElement currentMethod;
|
||||
|
||||
/**
|
||||
* Construct a new MethodWriterImpl.
|
||||
*
|
||||
* @param writer the writer for the class that the methods belong to.\
|
||||
*/
|
||||
public MethodWriter(ClassWriter writer) {
|
||||
super(writer, writer.typeElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new MethodWriterImpl.
|
||||
*
|
||||
* @param writer the writer for the class that the methods belong to.
|
||||
* @param typeElement the class being documented.
|
||||
* @param typeElement the class
|
||||
*/
|
||||
public MethodWriterImpl(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
public MethodWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
}
|
||||
|
||||
@ -67,10 +82,97 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
*
|
||||
* @param writer The writer for the class that the methods belong to.
|
||||
*/
|
||||
public MethodWriterImpl(SubWriterHolderWriter writer) {
|
||||
// used in ClassUseWriter and SummaryUseWriter
|
||||
public MethodWriter(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
public void build(Content target) throws DocletException {
|
||||
buildMethodDoc(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the method documentation.
|
||||
*
|
||||
* @param detailsList the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildMethodDoc(Content detailsList) {
|
||||
var methods = getVisibleMembers(VisibleMemberTable.Kind.METHODS);
|
||||
if (!methods.isEmpty()) {
|
||||
Content methodDetailsHeader = getMethodDetailsHeader(detailsList);
|
||||
Content memberList = writer.getMemberList();
|
||||
|
||||
for (Element method : methods) {
|
||||
currentMethod = (ExecutableElement)method;
|
||||
Content methodContent = getMethodHeader(currentMethod);
|
||||
|
||||
buildSignature(methodContent);
|
||||
buildDeprecationInfo(methodContent);
|
||||
buildPreviewInfo(methodContent);
|
||||
buildMethodComments(methodContent);
|
||||
buildTagInfo(methodContent);
|
||||
|
||||
memberList.add(writer.getMemberListItem(methodContent));
|
||||
}
|
||||
Content methodDetails = getMethodDetails(methodDetailsHeader, memberList);
|
||||
detailsList.add(methodDetails);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature.
|
||||
*
|
||||
* @param methodContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildSignature(Content methodContent) {
|
||||
methodContent.add(getSignature(currentMethod));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the deprecation information.
|
||||
*
|
||||
* @param methodContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildDeprecationInfo(Content methodContent) {
|
||||
addDeprecated(currentMethod, methodContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the preview information.
|
||||
*
|
||||
* @param methodContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPreviewInfo(Content methodContent) {
|
||||
addPreview(currentMethod, methodContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the comments for the method. Do nothing if
|
||||
* {@link BaseOptions#noComment()} is set to true.
|
||||
*
|
||||
* @param methodContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildMethodComments(Content methodContent) {
|
||||
if (!options.noComment()) {
|
||||
assert utils.isMethod(currentMethod); // not all executables are methods
|
||||
var docFinder = utils.docFinder();
|
||||
Optional<ExecutableElement> r = docFinder.search(currentMethod,
|
||||
m -> DocFinder.Result.fromOptional(utils.getFullBody(m).isEmpty() ? Optional.empty() : Optional.of(m))).toOptional();
|
||||
ExecutableElement method = r.orElse(currentMethod);
|
||||
TypeMirror containingType = method.getEnclosingElement().asType();
|
||||
addComments(containingType, method, methodContent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information.
|
||||
*
|
||||
* @param methodContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildTagInfo(Content methodContent) {
|
||||
addTags(currentMethod, methodContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberSummaryHeader(TypeElement typeElement, Content target) {
|
||||
target.add(MarkerComments.START_OF_METHOD_SUMMARY);
|
||||
@ -85,8 +187,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
HtmlIds.METHOD_SUMMARY, summariesList, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMethodDetailsHeader(Content content) {
|
||||
protected Content getMethodDetailsHeader(Content content) {
|
||||
content.add(MarkerComments.START_OF_METHOD_DETAILS);
|
||||
Content methodDetailsContent = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
|
||||
@ -95,8 +196,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
return methodDetailsContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMethodHeader(ExecutableElement method) {
|
||||
protected Content getMethodHeader(ExecutableElement method) {
|
||||
Content content = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
|
||||
Text.of(name(method)));
|
||||
@ -109,8 +209,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
.setId(htmlIds.forMember(method));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSignature(ExecutableElement method) {
|
||||
protected Content getSignature(ExecutableElement method) {
|
||||
return new Signatures.MemberSignature(method, this)
|
||||
.setTypeParameters(getTypeParameters(method))
|
||||
.setReturnType(getReturnType(method))
|
||||
@ -120,18 +219,15 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
.toContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeprecated(ExecutableElement method, Content methodContent) {
|
||||
protected void addDeprecated(ExecutableElement method, Content methodContent) {
|
||||
addDeprecatedInfo(method, methodContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPreview(ExecutableElement method, Content content) {
|
||||
protected void addPreview(ExecutableElement method, Content content) {
|
||||
addPreviewInfo(method, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComments(TypeMirror holderType, ExecutableElement method, Content methodContent) {
|
||||
protected void addComments(TypeMirror holderType, ExecutableElement method, Content methodContent) {
|
||||
TypeElement holder = utils.asTypeElement(holderType);
|
||||
if (!utils.getFullBody(method).isEmpty()) {
|
||||
if (holder.equals(typeElement) ||
|
||||
@ -160,13 +256,11 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(ExecutableElement method, Content methodContent) {
|
||||
protected void addTags(ExecutableElement method, Content methodContent) {
|
||||
writer.addTagsInfo(method, methodContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMethodDetails(Content methodDetailsHeader, Content methodDetails) {
|
||||
protected Content getMethodDetails(Content methodDetailsHeader, Content methodDetails) {
|
||||
Content c = new ContentBuilder(methodDetailsHeader, methodDetails);
|
||||
return getMember(HtmlTree.SECTION(HtmlStyle.methodDetails, c)
|
||||
.setId(HtmlIds.METHOD_DETAIL));
|
||||
@ -264,15 +358,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
Contents contents = writer.contents;
|
||||
Content label;
|
||||
HtmlLinkInfo.Kind context;
|
||||
if (utils.isAbstract(holder) && utils.isAbstract(method)) {
|
||||
//Abstract method is implemented from abstract class,
|
||||
//not overridden
|
||||
label = contents.specifiedByLabel;
|
||||
context = HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS;
|
||||
} else {
|
||||
label = contents.overridesLabel;
|
||||
context = HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS;
|
||||
}
|
||||
// Abstract method is implemented from abstract class, not overridden
|
||||
label = utils.isAbstract(holder) && utils.isAbstract(method) ? contents.specifiedByLabel : contents.overridesLabel;
|
||||
context = HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS;
|
||||
dl.add(HtmlTree.DT(label));
|
||||
Content overriddenTypeLink =
|
||||
writer.getLink(new HtmlLinkInfo(writer.configuration, context, overriddenType));
|
||||
@ -347,8 +435,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMemberHeader(){
|
||||
protected Content getMemberHeader(){
|
||||
return writer.getMemberHeader();
|
||||
}
|
||||
}
|
@ -34,7 +34,6 @@ import javax.lang.model.element.ModuleElement;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
@ -50,8 +50,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
|
||||
@ -60,7 +59,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
* required modules, packages and service types for the module. A click on any of the links will update
|
||||
* the frame with the clicked element page.
|
||||
*/
|
||||
public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryWriter {
|
||||
public class ModuleWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The module being documented.
|
||||
@ -91,7 +90,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
* A package that is neither exported or opened to any modules is a concealed package.
|
||||
* An open module opens all its packages to all modules.
|
||||
*/
|
||||
class PackageEntry {
|
||||
static class PackageEntry {
|
||||
/**
|
||||
* Summary of package exports:
|
||||
* If null, the package is not exported to any modules;
|
||||
@ -159,15 +158,107 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param mdle Module under consideration.
|
||||
*/
|
||||
public ModuleWriterImpl(HtmlConfiguration configuration, ModuleElement mdle) {
|
||||
public ModuleWriter(HtmlConfiguration configuration, ModuleElement mdle) {
|
||||
super(configuration, configuration.docPaths.moduleSummary(mdle));
|
||||
this.mdle = mdle;
|
||||
this.moduleMode = configuration.docEnv.getModuleMode();
|
||||
computeModulesData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getModuleHeader(String heading) {
|
||||
/**
|
||||
* Build the module summary.
|
||||
*
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
public void build() throws DocletException {
|
||||
buildModuleDoc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the module documentation.
|
||||
*
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
protected void buildModuleDoc() throws DocletException {
|
||||
Content content = getModuleHeader(mdle.getQualifiedName().toString());
|
||||
|
||||
buildContent();
|
||||
|
||||
addModuleFooter();
|
||||
printDocument(content);
|
||||
var docFilesHandler = configuration.getWriterFactory().getDocFilesHandler(mdle);
|
||||
docFilesHandler.copyDocFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the content for the module doc.
|
||||
*/
|
||||
protected void buildContent() {
|
||||
Content moduleContent = getContentHeader();
|
||||
|
||||
addModuleSignature(moduleContent);
|
||||
buildModuleDescription(moduleContent);
|
||||
buildSummary(moduleContent);
|
||||
|
||||
addModuleContent(moduleContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the list of summary sections for this module.
|
||||
*
|
||||
* @param target the module content to which the summaries will
|
||||
* be added
|
||||
*/
|
||||
protected void buildSummary(Content target) {
|
||||
Content summariesList = getSummariesList();
|
||||
|
||||
buildPackagesSummary(summariesList);
|
||||
buildModulesSummary(summariesList);
|
||||
buildServicesSummary(summariesList);
|
||||
|
||||
target.add(getSummary(summariesList));
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the summary of the module dependencies of this module.
|
||||
*
|
||||
* @param summariesList the list of summaries to which the summary will be added
|
||||
*/
|
||||
protected void buildModulesSummary(Content summariesList) {
|
||||
addModulesSummary(summariesList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the summary of the packages exported or opened by this module.
|
||||
*
|
||||
* @param summariesList the list of summaries to which the summary will be added
|
||||
*/
|
||||
protected void buildPackagesSummary(Content summariesList) {
|
||||
addPackagesSummary(summariesList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the summary of the services used or provided by this module.
|
||||
*
|
||||
* @param summariesList the list of summaries to which the summary will be added
|
||||
*/
|
||||
protected void buildServicesSummary(Content summariesList) {
|
||||
addServicesSummary(summariesList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the description for this module.
|
||||
*
|
||||
* @param moduleContent the content to which the module description will
|
||||
* be added
|
||||
*/
|
||||
protected void buildModuleDescription(Content moduleContent) {
|
||||
if (!options.noComment()) {
|
||||
addModuleDescription(moduleContent);
|
||||
}
|
||||
}
|
||||
|
||||
protected Content getModuleHeader(String heading) {
|
||||
HtmlTree body = getBody(getWindowTitle(mdle.getQualifiedName().toString()));
|
||||
var div = HtmlTree.DIV(HtmlStyle.header);
|
||||
Content moduleHead = new ContentBuilder();
|
||||
@ -197,18 +288,15 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getContentHeader() {
|
||||
protected Content getContentHeader() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSummariesList() {
|
||||
protected Content getSummariesList() {
|
||||
return HtmlTree.UL(HtmlStyle.summaryList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSummary(Content source) {
|
||||
protected Content getSummary(Content source) {
|
||||
return HtmlTree.SECTION(HtmlStyle.summary, source);
|
||||
}
|
||||
|
||||
@ -448,8 +536,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addModulesSummary(Content summariesList) {
|
||||
protected void addModulesSummary(Content summariesList) {
|
||||
if (display(requires) || display(indirectModules)) {
|
||||
TableHeader requiresTableHeader =
|
||||
new TableHeader(contents.modifierLabel, contents.moduleLabel,
|
||||
@ -492,8 +579,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPackagesSummary(Content summariesList) {
|
||||
protected void addPackagesSummary(Content summariesList) {
|
||||
if (display(packages)
|
||||
|| display(indirectPackages) || display(indirectOpenPackages)) {
|
||||
var section = HtmlTree.SECTION(HtmlStyle.packagesSummary)
|
||||
@ -659,8 +745,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addServicesSummary(Content summariesList) {
|
||||
protected void addServicesSummary(Content summariesList) {
|
||||
|
||||
boolean haveUses = displayServices(uses, usesTrees);
|
||||
boolean haveProvides = displayServices(provides.keySet(), providesTrees);
|
||||
@ -786,8 +871,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addModuleDescription(Content moduleContent) {
|
||||
protected void addModuleDescription(Content moduleContent) {
|
||||
addPreviewInfo(mdle, moduleContent);
|
||||
if (!utils.getFullBody(mdle).isEmpty()) {
|
||||
var tree = HtmlTree.SECTION(HtmlStyle.moduleDescription)
|
||||
@ -800,24 +884,20 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addModuleSignature(Content moduleContent) {
|
||||
protected void addModuleSignature(Content moduleContent) {
|
||||
moduleContent.add(new HtmlTree(TagName.HR));
|
||||
moduleContent.add(Signatures.getModuleSignature(mdle, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addModuleContent(Content source) {
|
||||
protected void addModuleContent(Content source) {
|
||||
bodyContents.addMainContent(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addModuleFooter() {
|
||||
protected void addModuleFooter() {
|
||||
bodyContents.setFooter(getFooter());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDocument(Content content) throws DocFileIOException {
|
||||
protected void printDocument(Content content) throws DocFileIOException {
|
||||
content.add(bodyContents);
|
||||
printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
|
||||
getDescription("declaration", mdle), getLocalStylesheets(mdle), content);
|
@ -42,15 +42,12 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Links;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind.*;
|
||||
|
||||
/**
|
||||
* Factory for navigation bar.
|
||||
*
|
||||
@ -98,7 +95,7 @@ public class Navigation {
|
||||
SEARCH,
|
||||
SYSTEM_PROPERTIES,
|
||||
TREE,
|
||||
USE;
|
||||
USE
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,20 +36,17 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
|
||||
/**
|
||||
* Writes nested class documentation in HTML format.
|
||||
*/
|
||||
public class NestedClassWriterImpl extends AbstractMemberWriter
|
||||
implements MemberSummaryWriter {
|
||||
public class NestedClassWriter extends AbstractMemberWriter {
|
||||
|
||||
public NestedClassWriterImpl(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
public NestedClassWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
}
|
||||
|
||||
public NestedClassWriterImpl(SubWriterHolderWriter writer) {
|
||||
public NestedClassWriter(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
@ -32,7 +32,6 @@ import javax.lang.model.element.PackageElement;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
@ -33,7 +33,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
@ -41,7 +41,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
@ -48,8 +48,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
@ -60,8 +59,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
* frame. This will list all the Class Kinds in the package. A click on any
|
||||
* class-kind will update the frame with the clicked class-kind page.
|
||||
*/
|
||||
public class PackageWriterImpl extends HtmlDocletWriter
|
||||
implements PackageSummaryWriter {
|
||||
public class PackageWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The package being documented.
|
||||
@ -94,7 +92,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param packageElement PackageElement under consideration.
|
||||
*/
|
||||
public PackageWriterImpl(HtmlConfiguration configuration, PackageElement packageElement) {
|
||||
public PackageWriter(HtmlConfiguration configuration, PackageElement packageElement) {
|
||||
super(configuration,
|
||||
configuration.docPaths.forPackage(packageElement)
|
||||
.resolve(DocPaths.PACKAGE_SUMMARY));
|
||||
@ -102,8 +100,107 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
computePackageData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getPackageHeader() {
|
||||
/**
|
||||
* Build the package summary.
|
||||
*
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
public void build() throws DocletException {
|
||||
buildPackageDoc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the package documentation.
|
||||
*
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
protected void buildPackageDoc() throws DocletException {
|
||||
Content content = getPackageHeader();
|
||||
|
||||
buildContent();
|
||||
|
||||
addPackageFooter();
|
||||
printDocument(content);
|
||||
var docFilesHandler = configuration
|
||||
.getWriterFactory()
|
||||
.getDocFilesHandler(packageElement);
|
||||
docFilesHandler.copyDocFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the content for the package.
|
||||
*/
|
||||
protected void buildContent() {
|
||||
Content packageContent = getContentHeader();
|
||||
|
||||
addPackageSignature(packageContent);
|
||||
buildPackageDescription(packageContent);
|
||||
buildPackageTags(packageContent);
|
||||
buildSummary(packageContent);
|
||||
|
||||
addPackageContent(packageContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the list of summaries for the different kinds of types in this package.
|
||||
*
|
||||
* @param packageContent the package content to which the summaries will
|
||||
* be added
|
||||
*/
|
||||
protected void buildSummary(Content packageContent) {
|
||||
Content summariesList = getSummariesList();
|
||||
|
||||
buildRelatedPackagesSummary(summariesList);
|
||||
buildAllClassesAndInterfacesSummary(summariesList);
|
||||
|
||||
packageContent.add(getPackageSummary(summariesList));
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a list of "nearby" packages (subpackages, superpackages, and sibling packages).
|
||||
*
|
||||
* @param summariesList the list of summaries to which the summary will be added
|
||||
*/
|
||||
protected void buildRelatedPackagesSummary(Content summariesList) {
|
||||
addRelatedPackagesSummary(summariesList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the summary for all classes and interfaces in this package.
|
||||
*
|
||||
* @param summariesList the list of summaries to which the summary will be added
|
||||
*/
|
||||
protected void buildAllClassesAndInterfacesSummary(Content summariesList) {
|
||||
addAllClassesAndInterfacesSummary(summariesList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build the description of the summary.
|
||||
*
|
||||
* @param packageContent the content to which the package description will
|
||||
* be added
|
||||
*/
|
||||
protected void buildPackageDescription(Content packageContent) {
|
||||
if (options.noComment()) {
|
||||
return;
|
||||
}
|
||||
addPackageDescription(packageContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tags of the summary.
|
||||
*
|
||||
* @param packageContent the content to which the package tags will be added
|
||||
*/
|
||||
protected void buildPackageTags(Content packageContent) {
|
||||
if (options.noComment()) {
|
||||
return;
|
||||
}
|
||||
addPackageTags(packageContent);
|
||||
}
|
||||
|
||||
protected Content getPackageHeader() {
|
||||
String packageName = getLocalizedPackageName(packageElement).toString();
|
||||
HtmlTree body = getBody(getWindowTitle(packageName));
|
||||
var div = HtmlTree.DIV(HtmlStyle.header);
|
||||
@ -129,8 +226,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
return body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getContentHeader() {
|
||||
protected Content getContentHeader() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
@ -219,13 +315,11 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSummariesList() {
|
||||
protected Content getSummariesList() {
|
||||
return HtmlTree.UL(HtmlStyle.summaryList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRelatedPackagesSummary(Content summaryContent) {
|
||||
protected void addRelatedPackagesSummary(Content summaryContent) {
|
||||
boolean showModules = configuration.showModules && hasRelatedPackagesInOtherModules(relatedPackages);
|
||||
TableHeader tableHeader= showModules
|
||||
? new TableHeader(contents.moduleLabel, contents.packageLabel, contents.descriptionLabel)
|
||||
@ -247,10 +341,10 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
.setId(HtmlIds.CLASS_SUMMARY)
|
||||
.setDefaultTab(contents.allClassesAndInterfacesLabel)
|
||||
.addTab(contents.interfaces, utils::isPlainInterface)
|
||||
.addTab(contents.classes, e -> utils.isNonThrowableClass(e))
|
||||
.addTab(contents.classes, utils::isNonThrowableClass)
|
||||
.addTab(contents.enums, utils::isEnum)
|
||||
.addTab(contents.records, e -> utils.isRecord(e))
|
||||
.addTab(contents.exceptionClasses, e -> utils.isThrowable(e))
|
||||
.addTab(contents.records, utils::isRecord)
|
||||
.addTab(contents.exceptionClasses, utils::isThrowable)
|
||||
.addTab(contents.annotationTypes, utils::isAnnotationInterface);
|
||||
for (TypeElement typeElement : allClasses) {
|
||||
if (typeElement != null && utils.isCoreClass(typeElement)) {
|
||||
@ -319,8 +413,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPackageDescription(Content packageContent) {
|
||||
protected void addPackageDescription(Content packageContent) {
|
||||
addPreviewInfo(packageElement, packageContent);
|
||||
if (!utils.getBody(packageElement).isEmpty()) {
|
||||
section.setId(HtmlIds.PACKAGE_DESCRIPTION);
|
||||
@ -329,30 +422,25 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPackageTags(Content packageContent) {
|
||||
protected void addPackageTags(Content packageContent) {
|
||||
addTagsInfo(packageElement, section);
|
||||
packageContent.add(section);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPackageSignature(Content packageContent) {
|
||||
protected void addPackageSignature(Content packageContent) {
|
||||
packageContent.add(new HtmlTree(TagName.HR));
|
||||
packageContent.add(Signatures.getPackageSignature(packageElement, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPackageContent(Content packageContent) {
|
||||
protected void addPackageContent(Content packageContent) {
|
||||
bodyContents.addMainContent(packageContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPackageFooter() {
|
||||
protected void addPackageFooter() {
|
||||
bodyContents.setFooter(getFooter());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDocument(Content content) throws DocFileIOException {
|
||||
protected void printDocument(Content content) throws DocFileIOException {
|
||||
String description = getDescription("declaration", packageElement);
|
||||
List<DocPath> localStylesheets = getLocalStylesheets(packageElement);
|
||||
content.add(bodyContents);
|
||||
@ -360,8 +448,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
description, localStylesheets, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getPackageSummary(Content summaryContent) {
|
||||
protected Content getPackageSummary(Content summaryContent) {
|
||||
return HtmlTree.SECTION(HtmlStyle.summary, summaryContent);
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
@ -25,29 +25,137 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import com.sun.source.doctree.DocCommentTree;
|
||||
import com.sun.source.doctree.DocTree;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.PropertyWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
|
||||
import jdk.javadoc.internal.doclets.toolkit.CommentUtils;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
/**
|
||||
* Writes property documentation in HTML format.
|
||||
*/
|
||||
public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
implements PropertyWriter, MemberSummaryWriter {
|
||||
public class PropertyWriter extends AbstractMemberWriter {
|
||||
|
||||
public PropertyWriterImpl(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
/**
|
||||
* The index of the current property that is being documented at this point
|
||||
* in time.
|
||||
*/
|
||||
private ExecutableElement currentProperty;
|
||||
|
||||
public PropertyWriter(ClassWriter writer) {
|
||||
super(writer, writer.typeElement);
|
||||
}
|
||||
|
||||
public void build(Content target) {
|
||||
buildPropertyDoc(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the property documentation.
|
||||
*
|
||||
* @param detailsList the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPropertyDoc(Content detailsList) {
|
||||
var properties = getVisibleMembers(VisibleMemberTable.Kind.PROPERTIES);
|
||||
if (!properties.isEmpty()) {
|
||||
Content propertyDetailsHeader = getPropertyDetailsHeader(detailsList);
|
||||
Content memberList = getMemberList();
|
||||
|
||||
for (Element property : properties) {
|
||||
currentProperty = (ExecutableElement)property;
|
||||
Content propertyContent = getPropertyHeaderContent(currentProperty);
|
||||
|
||||
buildSignature(propertyContent);
|
||||
buildPropertyComments(propertyContent);
|
||||
buildTagInfo(propertyContent);
|
||||
|
||||
memberList.add(getMemberListItem(propertyContent));
|
||||
}
|
||||
Content propertyDetails = getPropertyDetails(propertyDetailsHeader, memberList);
|
||||
detailsList.add(propertyDetails);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature.
|
||||
*
|
||||
* @param propertyContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildSignature(Content propertyContent) {
|
||||
propertyContent.add(getSignature(currentProperty));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the deprecation information.
|
||||
*
|
||||
* @param propertyContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildDeprecationInfo(Content propertyContent) {
|
||||
addDeprecated(currentProperty, propertyContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the preview information.
|
||||
*
|
||||
* @param propertyContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPreviewInfo(Content propertyContent) {
|
||||
addPreview(currentProperty, propertyContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the comments for the property. Do nothing if
|
||||
* {@link BaseOptions#noComment()} is set to true.
|
||||
*
|
||||
* @param propertyContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPropertyComments(Content propertyContent) {
|
||||
if (!options.noComment()) {
|
||||
addComments(currentProperty, propertyContent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information.
|
||||
*
|
||||
* @param propertyContent the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildTagInfo(Content propertyContent) {
|
||||
CommentUtils cmtUtils = configuration.cmtUtils;
|
||||
DocCommentTree dct = utils.getDocCommentTree(currentProperty);
|
||||
var fullBody = dct.getFullBody();
|
||||
ArrayList<DocTree> blockTags = dct.getBlockTags().stream()
|
||||
.filter(t -> t.getKind() != DocTree.Kind.RETURN)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
String sig = "#" + currentProperty.getSimpleName() + "()";
|
||||
blockTags.add(cmtUtils.makeSeeTree(sig, currentProperty));
|
||||
// The property method is used as a proxy for the property
|
||||
// (which does not have an explicit element of its own.)
|
||||
// Temporarily override the doc comment for the property method
|
||||
// by removing the `@return` tag, which should not be displayed for
|
||||
// the property.
|
||||
CommentUtils.DocCommentInfo prev = cmtUtils.setDocCommentTree(currentProperty, fullBody, blockTags);
|
||||
try {
|
||||
addTags(currentProperty, propertyContent);
|
||||
} finally {
|
||||
cmtUtils.setDocCommentInfo(currentProperty, prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Content getMemberSummaryHeader(TypeElement typeElement, Content content) {
|
||||
content.add(MarkerComments.START_OF_PROPERTY_SUMMARY);
|
||||
@ -62,8 +170,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
HtmlIds.PROPERTY_SUMMARY, summariesList, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getPropertyDetailsHeader(Content memberDetails) {
|
||||
protected Content getPropertyDetailsHeader(Content memberDetails) {
|
||||
memberDetails.add(MarkerComments.START_OF_PROPERTY_DETAILS);
|
||||
Content propertyDetailsContent = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
|
||||
@ -72,8 +179,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
return propertyDetailsContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getPropertyHeaderContent(ExecutableElement property) {
|
||||
protected Content getPropertyHeaderContent(ExecutableElement property) {
|
||||
Content content = new ContentBuilder();
|
||||
var heading = HtmlTree.HEADING(Headings.TypeDeclaration.MEMBER_HEADING,
|
||||
Text.of(utils.getPropertyLabel(name(property))));
|
||||
@ -82,24 +188,20 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
.setId(htmlIds.forProperty(property));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSignature(ExecutableElement property) {
|
||||
protected Content getSignature(ExecutableElement property) {
|
||||
return new Signatures.MemberSignature(property, this)
|
||||
.setType(utils.getReturnType(typeElement, property))
|
||||
.setAnnotations(writer.getAnnotationInfo(property, true))
|
||||
.toContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeprecated(ExecutableElement property, Content propertyContent) {
|
||||
protected void addDeprecated(ExecutableElement property, Content propertyContent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPreview(ExecutableElement property, Content content) {
|
||||
protected void addPreview(ExecutableElement property, Content content) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComments(ExecutableElement property, Content propertyContent) {
|
||||
protected void addComments(ExecutableElement property, Content propertyContent) {
|
||||
TypeElement holder = (TypeElement)property.getEnclosingElement();
|
||||
if (!utils.getFullBody(property).isEmpty()) {
|
||||
if (holder.equals(typeElement) ||
|
||||
@ -126,13 +228,11 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(ExecutableElement property, Content propertyContent) {
|
||||
protected void addTags(ExecutableElement property, Content propertyContent) {
|
||||
writer.addTagsInfo(property, propertyContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getPropertyDetails(Content memberDetailsHeader, Content memberDetails) {
|
||||
protected Content getPropertyDetails(Content memberDetailsHeader, Content memberDetails) {
|
||||
return writer.getDetailsListItem(
|
||||
HtmlTree.SECTION(HtmlStyle.propertyDetails)
|
||||
.setId(HtmlIds.PROPERTY_DETAIL)
|
@ -34,7 +34,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
@ -41,18 +41,15 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.formats.html.taglets.TagletWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter;
|
||||
|
||||
/**
|
||||
* Generate serialized form for serializable fields.
|
||||
* Documentation denoted by the tags <code>serial</code> and
|
||||
* <code>serialField</code> is processed.
|
||||
*/
|
||||
public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
implements SerializedFormWriter.SerialFieldWriter {
|
||||
public class SerialFieldWriter extends FieldWriter {
|
||||
|
||||
public HtmlSerialFieldWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
public SerialFieldWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
}
|
||||
|
||||
@ -60,18 +57,15 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
return utils.serializableFields(te);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSerializableFieldsHeader() {
|
||||
protected Content getSerializableFieldsHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getFieldsContentHeader(boolean isLastContent) {
|
||||
protected Content getFieldsContentHeader(boolean isLastContent) {
|
||||
return new HtmlTree(TagName.LI).setStyle(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSerializableFields(String heading, Content source) {
|
||||
protected Content getSerializableFields(String heading, Content source) {
|
||||
var section = HtmlTree.SECTION(HtmlStyle.detail);
|
||||
if (!source.isEmpty()) {
|
||||
Content headingContent = Text.of(heading);
|
||||
@ -82,8 +76,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
return HtmlTree.LI(section);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMemberHeader(TypeMirror fieldType, String fieldName, Content content) {
|
||||
protected void addMemberHeader(TypeMirror fieldType, String fieldName, Content content) {
|
||||
Content nameContent = Text.of(fieldName);
|
||||
var heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, nameContent);
|
||||
content.add(heading);
|
||||
@ -102,8 +95,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
* @param field the field to document.
|
||||
* @param content the content to which the deprecated info will be added
|
||||
*/
|
||||
@Override
|
||||
public void addMemberDeprecatedInfo(VariableElement field, Content content) {
|
||||
protected void addMemberDeprecatedInfo(VariableElement field, Content content) {
|
||||
addDeprecatedInfo(field, content);
|
||||
}
|
||||
|
||||
@ -113,8 +105,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
* @param field the field to document.
|
||||
* @param content the content to which the deprecated info will be added
|
||||
*/
|
||||
@Override
|
||||
public void addMemberDescription(VariableElement field, Content content) {
|
||||
protected void addMemberDescription(VariableElement field, Content content) {
|
||||
if (!utils.getFullBody(field).isEmpty()) {
|
||||
writer.addInlineComment(field, content);
|
||||
}
|
||||
@ -130,8 +121,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
* @param serialFieldTag the field to document (represented by tag)
|
||||
* @param content the content to which the deprecated info will be added
|
||||
*/
|
||||
@Override
|
||||
public void addMemberDescription(VariableElement field, SerialFieldTree serialFieldTag, Content content) {
|
||||
protected void addMemberDescription(VariableElement field, SerialFieldTree serialFieldTag, Content content) {
|
||||
List<? extends DocTree> description = serialFieldTag.getDescription();
|
||||
if (!description.isEmpty()) {
|
||||
Content serialFieldContent = writer.commentTagsToContent(field,
|
||||
@ -148,8 +138,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
* @param field the field to document.
|
||||
* @param content the content to which the member tags info will be added
|
||||
*/
|
||||
@Override
|
||||
public void addMemberTags(VariableElement field, Content content) {
|
||||
protected void addMemberTags(VariableElement field, Content content) {
|
||||
Content tagContent = writer.getBlockTagOutput(field);
|
||||
if (!tagContent.isEmpty()) {
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
@ -166,8 +155,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
* @param field the field to check overview details for.
|
||||
* @return true if overview details need to be printed
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldPrintOverview(VariableElement field) {
|
||||
protected boolean shouldPrintOverview(VariableElement field) {
|
||||
if (!options.noComment()) {
|
||||
if(!utils.getFullBody(field).isEmpty() ||
|
||||
writer.hasSerializationOverviewTags(field))
|
@ -29,11 +29,9 @@ import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter;
|
||||
import jdk.javadoc.internal.doclets.formats.html.taglets.TagletManager;
|
||||
|
||||
|
||||
@ -41,20 +39,17 @@ import jdk.javadoc.internal.doclets.formats.html.taglets.TagletManager;
|
||||
* Generate serialized form for Serializable/Externalizable methods.
|
||||
* Documentation denoted by the <code>serialData</code> tag is processed.
|
||||
*/
|
||||
public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
SerializedFormWriter.SerialMethodWriter {
|
||||
public class SerialMethodWriter extends MethodWriter {
|
||||
|
||||
public HtmlSerialMethodWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
public SerialMethodWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSerializableMethodsHeader() {
|
||||
protected Content getSerializableMethodsHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getMethodsContentHeader(boolean isLastContent) {
|
||||
protected Content getMethodsContentHeader(boolean isLastContent) {
|
||||
return new HtmlTree(TagName.LI);
|
||||
}
|
||||
|
||||
@ -66,8 +61,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
* content
|
||||
* @return a content for the serializable methods content
|
||||
*/
|
||||
@Override
|
||||
public Content getSerializableMethods(String heading, Content source) {
|
||||
protected Content getSerializableMethods(String heading, Content source) {
|
||||
Content headingContent = Text.of(heading);
|
||||
var serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent);
|
||||
var section = HtmlTree.SECTION(HtmlStyle.detail, serialHeading);
|
||||
@ -81,8 +75,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
* @param msg the message to be displayed
|
||||
* @return no customization message content
|
||||
*/
|
||||
@Override
|
||||
public Content getNoCustomizationMsg(String msg) {
|
||||
protected Content getNoCustomizationMsg(String msg) {
|
||||
return Text.of(msg);
|
||||
}
|
||||
|
||||
@ -92,8 +85,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
* @param member the method document to be listed
|
||||
* @param methodsContent the content to which the member header will be added
|
||||
*/
|
||||
@Override
|
||||
public void addMemberHeader(ExecutableElement member, Content methodsContent) {
|
||||
protected void addMemberHeader(ExecutableElement member, Content methodsContent) {
|
||||
Content memberContent = Text.of(name(member));
|
||||
var heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, memberContent);
|
||||
methodsContent.add(heading);
|
||||
@ -106,8 +98,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
* @param member the method to document.
|
||||
* @param methodsContent the content to which the deprecated info will be added
|
||||
*/
|
||||
@Override
|
||||
public void addDeprecatedMemberInfo(ExecutableElement member, Content methodsContent) {
|
||||
protected void addDeprecatedMemberInfo(ExecutableElement member, Content methodsContent) {
|
||||
addDeprecatedInfo(member, methodsContent);
|
||||
}
|
||||
|
||||
@ -117,8 +108,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
* @param member the method to document.
|
||||
* @param methodsContent the content to which the deprecated info will be added
|
||||
*/
|
||||
@Override
|
||||
public void addMemberDescription(ExecutableElement member, Content methodsContent) {
|
||||
protected void addMemberDescription(ExecutableElement member, Content methodsContent) {
|
||||
addComment(member, methodsContent);
|
||||
}
|
||||
|
||||
@ -128,8 +118,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
* @param member the method to document.
|
||||
* @param methodsContent the content to which the member tags info will be added
|
||||
*/
|
||||
@Override
|
||||
public void addMemberTags(ExecutableElement member, Content methodsContent) {
|
||||
protected void addMemberTags(ExecutableElement member, Content methodsContent) {
|
||||
TagletManager tagletManager = configuration.tagletManager;
|
||||
Content tagContent = writer.getBlockTagOutput(member, tagletManager.getSerializedFormTaglets());
|
||||
var dl = HtmlTree.DL(HtmlStyle.notes);
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, 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
|
||||
@ -23,12 +23,11 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit.builders;
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@ -41,31 +40,34 @@ import javax.lang.model.type.TypeMirror;
|
||||
|
||||
import com.sun.source.doctree.SerialFieldTree;
|
||||
import com.sun.source.doctree.SerialTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.IndexItem;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
/**
|
||||
* Builds the serialized form.
|
||||
* Generates the Serialized Form Information Page, <i>serialized-form.html</i>.
|
||||
*/
|
||||
public class SerializedFormBuilder extends AbstractBuilder {
|
||||
|
||||
/**
|
||||
* The writer for this builder.
|
||||
*/
|
||||
private SerializedFormWriter writer;
|
||||
public class SerializedFormWriter extends SubWriterHolderWriter {
|
||||
|
||||
/**
|
||||
* The writer for serializable fields.
|
||||
*/
|
||||
private SerializedFormWriter.SerialFieldWriter fieldWriter;
|
||||
private SerialFieldWriter fieldWriter;
|
||||
|
||||
/**
|
||||
* The writer for serializable method documentation.
|
||||
*/
|
||||
private SerializedFormWriter.SerialMethodWriter methodWriter;
|
||||
private SerialMethodWriter methodWriter;
|
||||
|
||||
/**
|
||||
* The header for the serial version UID. Save the string
|
||||
@ -90,22 +92,15 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
*/
|
||||
protected Element currentMember;
|
||||
|
||||
/**
|
||||
* Construct a new SerializedFormBuilder.
|
||||
* @param context the build context.
|
||||
*/
|
||||
private SerializedFormBuilder(Context context) {
|
||||
super(context);
|
||||
}
|
||||
Set<TypeElement> visibleClasses;
|
||||
|
||||
/**
|
||||
* Construct a new SerializedFormBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @return the new SerializedFormBuilder
|
||||
* @param configuration the configuration data for the doclet
|
||||
*/
|
||||
public static SerializedFormBuilder getInstance(Context context) {
|
||||
return new SerializedFormBuilder(context);
|
||||
public SerializedFormWriter(HtmlConfiguration configuration) {
|
||||
super(configuration, DocPaths.SERIALIZED_FORM, false);
|
||||
visibleClasses = configuration.getIncludedTypeElements();
|
||||
configuration.conditionalPages.add(HtmlConfiguration.ConditionalPage.SERIALIZED_FORM);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,19 +108,17 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
*
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
@Override
|
||||
public void build() throws DocletException {
|
||||
void build() throws DocletException {
|
||||
SortedSet<TypeElement> rootclasses = new TreeSet<>(utils.comparators.makeGeneralPurposeComparator());
|
||||
rootclasses.addAll(configuration.getIncludedTypeElements());
|
||||
if (!serialClassFoundToDocument(rootclasses)) {
|
||||
//Nothing to document.
|
||||
return;
|
||||
}
|
||||
writer = configuration.getWriterFactory().getSerializedFormWriter();
|
||||
if (writer == null) {
|
||||
//Doclet does not support this output.
|
||||
return;
|
||||
}
|
||||
|
||||
configuration.conditionalPages.add(HtmlConfiguration.ConditionalPage.SERIALIZED_FORM);
|
||||
writeGenerating();
|
||||
|
||||
buildSerializedForm();
|
||||
}
|
||||
|
||||
@ -135,39 +128,35 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
protected void buildSerializedForm() throws DocletException {
|
||||
Content content = writer.getHeader(resources.getText(
|
||||
Content content = getHeader(resources.getText(
|
||||
"doclet.Serialized_Form"));
|
||||
|
||||
buildSerializedFormSummaries();
|
||||
|
||||
writer.addFooter();
|
||||
writer.printDocument(content);
|
||||
addFooter();
|
||||
printDocument(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the serialized form summaries.
|
||||
*
|
||||
* @throws DocletException if there is a problem while building the documentation
|
||||
*/
|
||||
protected void buildSerializedFormSummaries()
|
||||
throws DocletException {
|
||||
Content c = writer.getSerializedSummariesHeader();
|
||||
protected void buildSerializedFormSummaries() {
|
||||
Content c = getSerializedSummariesHeader();
|
||||
for (PackageElement pkg : configuration.packages) {
|
||||
currentPackage = pkg;
|
||||
|
||||
buildPackageSerializedForm(c);
|
||||
}
|
||||
writer.addSerializedContent(c);
|
||||
addSerializedContent(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the package serialized form for the current package being processed.
|
||||
*
|
||||
* @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 target) throws DocletException {
|
||||
Content packageSerializedHeader = writer.getPackageSerializedHeader();
|
||||
protected void buildPackageSerializedForm(Content target) {
|
||||
Content packageSerializedHeader = getPackageSerializedHeader();
|
||||
SortedSet<TypeElement> classes = utils.getAllClassesUnfiltered(currentPackage);
|
||||
if (classes.isEmpty()) {
|
||||
return;
|
||||
@ -182,7 +171,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
buildPackageHeader(packageSerializedHeader);
|
||||
buildClassSerializedForm(packageSerializedHeader);
|
||||
|
||||
writer.addPackageSerialized(target, packageSerializedHeader);
|
||||
addPackageSerialized(target, packageSerializedHeader);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,33 +180,31 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
protected void buildPackageHeader(Content target) {
|
||||
target.add(writer.getPackageHeader(currentPackage));
|
||||
target.add(getPackageHeader(currentPackage));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the class serialized form.
|
||||
*
|
||||
* @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 target)
|
||||
throws DocletException {
|
||||
Content classSerializedHeader = writer.getClassSerializedHeader();
|
||||
protected void buildClassSerializedForm(Content target) {
|
||||
Content classSerializedHeader = getClassSerializedHeader();
|
||||
SortedSet<TypeElement> typeElements = utils.getAllClassesUnfiltered(currentPackage);
|
||||
for (TypeElement typeElement : typeElements) {
|
||||
currentTypeElement = typeElement;
|
||||
fieldWriter = writer.getSerialFieldWriter(currentTypeElement);
|
||||
methodWriter = writer.getSerialMethodWriter(currentTypeElement);
|
||||
fieldWriter = getSerialFieldWriter(currentTypeElement);
|
||||
methodWriter = getSerialMethodWriter(currentTypeElement);
|
||||
if (utils.isClass(currentTypeElement) && utils.isSerializable(currentTypeElement)) {
|
||||
if (!serialClassInclude(utils, currentTypeElement)) {
|
||||
continue;
|
||||
}
|
||||
Content classHeader = writer.getClassHeader(currentTypeElement);
|
||||
Content classHeader = getClassHeader(currentTypeElement);
|
||||
|
||||
buildSerialUIDInfo(classHeader);
|
||||
buildClassContent(classHeader);
|
||||
|
||||
classSerializedHeader.add(writer.getMember(classHeader));
|
||||
classSerializedHeader.add(getMember(classHeader));
|
||||
}
|
||||
}
|
||||
target.add(classSerializedHeader);
|
||||
@ -229,12 +216,12 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* @param target the content to which the serial UID information will be added
|
||||
*/
|
||||
protected void buildSerialUIDInfo(Content target) {
|
||||
Content serialUIDHeader = writer.getSerialUIDInfoHeader();
|
||||
Content serialUIDHeader = 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), serialUIDHeader);
|
||||
field.getConstantValue() != null) {
|
||||
addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
|
||||
utils.constantValueExpression(field), serialUIDHeader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -245,10 +232,9 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* Build the summaries for the methods and fields.
|
||||
*
|
||||
* @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 target) throws DocletException {
|
||||
Content classContent = writer.getClassContentHeader();
|
||||
protected void buildClassContent(Content target) {
|
||||
Content classContent = getClassContentHeader();
|
||||
|
||||
buildSerializableMethods(classContent);
|
||||
buildFieldHeader(classContent);
|
||||
@ -261,9 +247,8 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* Build the summaries for the methods that belong to the given class.
|
||||
*
|
||||
* @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 target) throws DocletException {
|
||||
protected void buildSerializableMethods(Content target) {
|
||||
Content serializableMethodsHeader = methodWriter.getSerializableMethodsHeader();
|
||||
for (var i = utils.serializationMethods(currentTypeElement).iterator(); i.hasNext(); ) {
|
||||
currentMember = i.next();
|
||||
@ -313,9 +298,8 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* Build the information for the method.
|
||||
*
|
||||
* @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 methodsContent) throws DocletException {
|
||||
protected void buildMethodInfo(Content methodsContent) {
|
||||
if (options.noComment()) {
|
||||
return;
|
||||
}
|
||||
@ -394,10 +378,8 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* Build the summaries for the fields that belong to the given class.
|
||||
*
|
||||
* @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 target)
|
||||
throws DocletException {
|
||||
protected void buildSerializableFields(Content target) {
|
||||
Collection<VariableElement> members = utils.serializableFields(currentTypeElement);
|
||||
if (!members.isEmpty()) {
|
||||
Content serializableFieldsHeader = fieldWriter.getSerializableFieldsHeader();
|
||||
@ -548,7 +530,6 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
}
|
||||
List<? extends SerialTree> serial = utils.getSerialTrees(element);
|
||||
if (!serial.isEmpty()) {
|
||||
CommentHelper ch = utils.getCommentHelper(element);
|
||||
// look for `@serial include|exclude`
|
||||
String serialtext = Utils.toLowerCase(serial.get(0).toString());
|
||||
if (serialtext.contains("exclude")) {
|
||||
@ -574,4 +555,172 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the given header.
|
||||
*
|
||||
* @param header the header to write
|
||||
* @return the body content
|
||||
*/
|
||||
Content getHeader(String header) {
|
||||
HtmlTree body = getBody(getWindowTitle(header));
|
||||
Content h1Content = Text.of(header);
|
||||
var heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
|
||||
HtmlStyle.title, h1Content);
|
||||
var div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
bodyContents.setHeader(getHeader(PageMode.SERIALIZED_FORM))
|
||||
.addMainContent(div);
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serialized form summaries header.
|
||||
*
|
||||
* @return the serialized form summaries header
|
||||
*/
|
||||
Content getSerializedSummariesHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the package serialized form header.
|
||||
*
|
||||
* @return the package serialized form header tree
|
||||
*/
|
||||
Content getPackageSerializedHeader() {
|
||||
return HtmlTree.SECTION(HtmlStyle.serializedPackageContainer);
|
||||
}
|
||||
|
||||
Content getPackageHeader(PackageElement packageElement) {
|
||||
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;
|
||||
}
|
||||
|
||||
Content getClassSerializedHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a class is generated and is visible.
|
||||
*
|
||||
* @param typeElement the class being processed.
|
||||
* @return true if the class, that is being processed, is generated and is visible.
|
||||
*/
|
||||
public boolean isVisibleClass(TypeElement typeElement) {
|
||||
return visibleClasses.contains(typeElement) && configuration.isGeneratedDoc(typeElement)
|
||||
&& !utils.hasHiddenTag(typeElement);
|
||||
}
|
||||
|
||||
Content getClassHeader(TypeElement typeElement) {
|
||||
Content classLink = (isVisibleClass(typeElement))
|
||||
? getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.PLAIN, typeElement)
|
||||
.label(configuration.getClassName(typeElement)))
|
||||
: Text.of(utils.getFullyQualifiedName(typeElement));
|
||||
var section = HtmlTree.SECTION(HtmlStyle.serializedClassDetails)
|
||||
.setId(htmlIds.forClass(typeElement));
|
||||
Content superClassLink = typeElement.getSuperclass() != null
|
||||
? getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS,
|
||||
typeElement.getSuperclass()))
|
||||
: null;
|
||||
Content interfaceLink = getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS,
|
||||
utils.isExternalizable(typeElement)
|
||||
? utils.getExternalizableType()
|
||||
: utils.getSerializableType()));
|
||||
|
||||
// Print the heading.
|
||||
Content className = new ContentBuilder();
|
||||
className.add(utils.getTypeElementKindName(typeElement, false));
|
||||
className.add(Entity.NO_BREAK_SPACE);
|
||||
className.add(classLink);
|
||||
section.add(HtmlTree.HEADING(Headings.SerializedForm.CLASS_HEADING, className));
|
||||
// Print a simplified signature.
|
||||
Content signature = new ContentBuilder();
|
||||
signature.add("class ");
|
||||
signature.add(typeElement.getSimpleName());
|
||||
signature.add(" extends ");
|
||||
signature.add(superClassLink);
|
||||
signature.add(" implements ");
|
||||
signature.add(interfaceLink);
|
||||
section.add(HtmlTree.DIV(HtmlStyle.typeSignature, signature));
|
||||
return section;
|
||||
}
|
||||
|
||||
Content getSerialUIDInfoHeader() {
|
||||
return HtmlTree.DL(HtmlStyle.nameValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the serial UID info.
|
||||
*
|
||||
* @param header the header that will show up before the UID.
|
||||
* @param serialUID the serial UID to print.
|
||||
* @param target the serial UID content to which the serial UID
|
||||
* content will be added
|
||||
*/
|
||||
void addSerialUIDInfo(String header,
|
||||
String serialUID,
|
||||
Content target)
|
||||
{
|
||||
Content headerContent = Text.of(header);
|
||||
target.add(HtmlTree.DT(headerContent));
|
||||
Content serialContent = Text.of(serialUID);
|
||||
target.add(HtmlTree.DD(serialContent));
|
||||
}
|
||||
|
||||
Content getClassContentHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the serialized content section.
|
||||
*
|
||||
* @param source the serialized content to be added
|
||||
*/
|
||||
void addSerializedContent(Content source) {
|
||||
bodyContents.addMainContent(source);
|
||||
}
|
||||
|
||||
void addPackageSerialized(Content serializedSummaries,
|
||||
Content packageSerialized)
|
||||
{
|
||||
serializedSummaries.add(HtmlTree.LI(packageSerialized));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the footer.
|
||||
*/
|
||||
void addFooter() {
|
||||
bodyContents.setFooter(getFooter());
|
||||
}
|
||||
|
||||
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,
|
||||
resources.getText("doclet.Serialized_Form"), path));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of a SerialFieldWriter.
|
||||
*
|
||||
* @return an instance of a SerialFieldWriter.
|
||||
*/
|
||||
SerialFieldWriter getSerialFieldWriter(TypeElement typeElement) {
|
||||
return new SerialFieldWriter(this, typeElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of a SerialMethodWriter.
|
||||
*
|
||||
* @return an instance of a SerialMethodWriter.
|
||||
*/
|
||||
SerialMethodWriter getSerialMethodWriter(TypeElement typeElement) {
|
||||
return new SerialMethodWriter(this, typeElement);
|
||||
}
|
||||
}
|
@ -1,244 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.IndexItem;
|
||||
|
||||
/**
|
||||
* Generates the Serialized Form Information Page, <i>serialized-form.html</i>.
|
||||
*/
|
||||
public class SerializedFormWriterImpl extends SubWriterHolderWriter
|
||||
implements SerializedFormWriter {
|
||||
|
||||
Set<TypeElement> visibleClasses;
|
||||
|
||||
/**
|
||||
* @param configuration the configuration data for the doclet
|
||||
*/
|
||||
public SerializedFormWriterImpl(HtmlConfiguration configuration) {
|
||||
super(configuration, DocPaths.SERIALIZED_FORM);
|
||||
visibleClasses = configuration.getIncludedTypeElements();
|
||||
configuration.conditionalPages.add(HtmlConfiguration.ConditionalPage.SERIALIZED_FORM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the given header.
|
||||
*
|
||||
* @param header the header to write
|
||||
* @return the body content
|
||||
*/
|
||||
@Override
|
||||
public Content getHeader(String header) {
|
||||
HtmlTree body = getBody(getWindowTitle(header));
|
||||
Content h1Content = Text.of(header);
|
||||
var heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
|
||||
HtmlStyle.title, h1Content);
|
||||
var div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
bodyContents.setHeader(getHeader(PageMode.SERIALIZED_FORM))
|
||||
.addMainContent(div);
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serialized form summaries header.
|
||||
*
|
||||
* @return the serialized form summaries header
|
||||
*/
|
||||
@Override
|
||||
public Content getSerializedSummariesHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the package serialized form header.
|
||||
*
|
||||
* @return the package serialized form header tree
|
||||
*/
|
||||
@Override
|
||||
public Content getPackageSerializedHeader() {
|
||||
return HtmlTree.SECTION(HtmlStyle.serializedPackageContainer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getPackageHeader(PackageElement packageElement) {
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getClassSerializedHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a class is generated and is visible.
|
||||
*
|
||||
* @param typeElement the class being processed.
|
||||
* @return true if the class, that is being processed, is generated and is visible.
|
||||
*/
|
||||
public boolean isVisibleClass(TypeElement typeElement) {
|
||||
return visibleClasses.contains(typeElement) && configuration.isGeneratedDoc(typeElement)
|
||||
&& !utils.hasHiddenTag(typeElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getClassHeader(TypeElement typeElement) {
|
||||
Content classLink = (isVisibleClass(typeElement))
|
||||
? getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.PLAIN, typeElement)
|
||||
.label(configuration.getClassName(typeElement)))
|
||||
: Text.of(utils.getFullyQualifiedName(typeElement));
|
||||
var section = HtmlTree.SECTION(HtmlStyle.serializedClassDetails)
|
||||
.setId(htmlIds.forClass(typeElement));
|
||||
Content superClassLink = typeElement.getSuperclass() != null
|
||||
? getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS,
|
||||
typeElement.getSuperclass()))
|
||||
: null;
|
||||
Content interfaceLink = getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS,
|
||||
utils.isExternalizable(typeElement)
|
||||
? utils.getExternalizableType()
|
||||
: utils.getSerializableType()));
|
||||
|
||||
// Print the heading.
|
||||
Content className = new ContentBuilder();
|
||||
className.add(utils.getTypeElementKindName(typeElement, false));
|
||||
className.add(Entity.NO_BREAK_SPACE);
|
||||
className.add(classLink);
|
||||
section.add(HtmlTree.HEADING(Headings.SerializedForm.CLASS_HEADING, className));
|
||||
// Print a simplified signature.
|
||||
Content signature = new ContentBuilder();
|
||||
signature.add("class ");
|
||||
signature.add(typeElement.getSimpleName());
|
||||
signature.add(" extends ");
|
||||
signature.add(superClassLink);
|
||||
signature.add(" implements ");
|
||||
signature.add(interfaceLink);
|
||||
section.add(HtmlTree.DIV(HtmlStyle.typeSignature, signature));
|
||||
return section;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getSerialUIDInfoHeader() {
|
||||
return HtmlTree.DL(HtmlStyle.nameValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the serial UID info.
|
||||
*
|
||||
* @param header the header that will show up before the UID.
|
||||
* @param serialUID the serial UID to print.
|
||||
* @param target the serial UID content to which the serial UID
|
||||
* content will be added
|
||||
*/
|
||||
@Override
|
||||
public void addSerialUIDInfo(String header,
|
||||
String serialUID,
|
||||
Content target)
|
||||
{
|
||||
Content headerContent = Text.of(header);
|
||||
target.add(HtmlTree.DT(headerContent));
|
||||
Content serialContent = Text.of(serialUID);
|
||||
target.add(HtmlTree.DD(serialContent));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getClassContentHeader() {
|
||||
return HtmlTree.UL(HtmlStyle.blockList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the serialized content section.
|
||||
*
|
||||
* @param source the serialized content to be added
|
||||
*/
|
||||
@Override
|
||||
public void addSerializedContent(Content source) {
|
||||
bodyContents.addMainContent(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPackageSerialized(Content serializedSummaries,
|
||||
Content packageSerialized)
|
||||
{
|
||||
serializedSummaries.add(HtmlTree.LI(packageSerialized));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the footer.
|
||||
*/
|
||||
@Override
|
||||
public void addFooter() {
|
||||
bodyContents.setFooter(getFooter());
|
||||
}
|
||||
|
||||
@Override
|
||||
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,
|
||||
resources.getText("doclet.Serialized_Form"), path));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of a SerialFieldWriter.
|
||||
*
|
||||
* @return an instance of a SerialFieldWriter.
|
||||
*/
|
||||
@Override
|
||||
public SerialFieldWriter getSerialFieldWriter(TypeElement typeElement) {
|
||||
return new HtmlSerialFieldWriter(this, typeElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of a SerialMethodWriter.
|
||||
*
|
||||
* @return an instance of a SerialMethodWriter.
|
||||
*/
|
||||
@Override
|
||||
public SerialMethodWriter getSerialMethodWriter(TypeElement typeElement) {
|
||||
return new HtmlSerialMethodWriter(this, typeElement);
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
@ -63,7 +62,7 @@ import static javax.lang.model.element.Modifier.SYNCHRONIZED;
|
||||
|
||||
public class Signatures {
|
||||
|
||||
public static Content getModuleSignature(ModuleElement mdle, ModuleWriterImpl moduleWriter) {
|
||||
public static Content getModuleSignature(ModuleElement mdle, ModuleWriter moduleWriter) {
|
||||
var signature = HtmlTree.DIV(HtmlStyle.moduleSignature);
|
||||
Content annotations = moduleWriter.getAnnotationInfo(mdle, true);
|
||||
if (!annotations.isEmpty()) {
|
||||
@ -80,7 +79,7 @@ public class Signatures {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public static Content getPackageSignature(PackageElement pkg, PackageWriterImpl pkgWriter) {
|
||||
public static Content getPackageSignature(PackageElement pkg, PackageWriter pkgWriter) {
|
||||
if (pkg.isUnnamed()) {
|
||||
return Text.EMPTY;
|
||||
}
|
||||
|
1
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
1
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
@ -43,7 +43,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
|
7
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java
7
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java
@ -37,7 +37,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
||||
/**
|
||||
@ -49,7 +48,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
* class subclass of this class can be subclassed to change formatting.
|
||||
*
|
||||
* @see AbstractMemberWriter
|
||||
* @see ClassWriterImpl
|
||||
* @see ClassWriter
|
||||
*/
|
||||
public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
|
||||
@ -62,6 +61,10 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
public SubWriterHolderWriter(HtmlConfiguration configuration, DocPath filename, boolean generating) {
|
||||
super(configuration, filename, generating);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the summary header.
|
||||
*
|
||||
|
@ -38,7 +38,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Script;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.SummaryAPIListBuilder;
|
||||
@ -251,13 +250,15 @@ public abstract class SummaryListWriter<B extends SummaryAPIListBuilder> extends
|
||||
}
|
||||
|
||||
protected Content getSummaryLink(Element e) {
|
||||
// TODO: notable that these do not go through the writerFactory
|
||||
// also maybe notable that annotation type members are not handled as such
|
||||
AbstractMemberWriter writer = switch (e.getKind()) {
|
||||
case INTERFACE, CLASS, ENUM,
|
||||
ANNOTATION_TYPE, RECORD -> new NestedClassWriterImpl(this);
|
||||
case FIELD -> new FieldWriterImpl(this);
|
||||
case METHOD -> new MethodWriterImpl(this);
|
||||
case CONSTRUCTOR -> new ConstructorWriterImpl(this);
|
||||
case ENUM_CONSTANT -> new EnumConstantWriterImpl(this);
|
||||
ANNOTATION_TYPE, RECORD -> new NestedClassWriter(this);
|
||||
case FIELD -> new FieldWriter(this);
|
||||
case METHOD -> new MethodWriter(this);
|
||||
case CONSTRUCTOR -> new ConstructorWriter(this);
|
||||
case ENUM_CONSTANT -> new EnumConstantWriter(this);
|
||||
case RECORD_COMPONENT ->
|
||||
throw new AssertionError("Record components are not supported by SummaryListWriter!");
|
||||
default ->
|
||||
|
1
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SystemPropertiesWriter.java
1
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SystemPropertiesWriter.java
@ -32,7 +32,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletElement;
|
||||
import jdk.javadoc.internal.doclets.toolkit.OverviewElement;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
|
@ -41,7 +41,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
|
||||
/**
|
||||
* An HTML container used to display summary tables for various kinds of elements
|
||||
|
@ -34,7 +34,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
|
||||
/**
|
||||
* A row of header cells for an HTML table.
|
||||
|
@ -34,7 +34,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
133
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactory.java
Normal file
133
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactory.java
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
/**
|
||||
* The factory that returns HTML writers.
|
||||
*/
|
||||
// TODO: be more consistent about using this factory
|
||||
public class WriterFactory {
|
||||
|
||||
private final HtmlConfiguration configuration;
|
||||
public WriterFactory(HtmlConfiguration configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
public ConstantsSummaryWriter getConstantsSummaryWriter() {
|
||||
return new ConstantsSummaryWriter(configuration);
|
||||
}
|
||||
|
||||
public PackageWriter getPackageSummaryWriter(PackageElement packageElement) {
|
||||
return new PackageWriter(configuration, packageElement);
|
||||
}
|
||||
|
||||
public ModuleWriter getModuleSummaryWriter(ModuleElement mdle) {
|
||||
return new ModuleWriter(configuration, mdle);
|
||||
}
|
||||
|
||||
public ClassWriter getClassWriter(TypeElement typeElement, ClassTree classTree) {
|
||||
return new ClassWriter(configuration, typeElement, classTree);
|
||||
}
|
||||
|
||||
public AnnotationTypeMemberWriter getAnnotationTypeMemberWriter(
|
||||
ClassWriter classWriter) {
|
||||
TypeElement te = classWriter.getTypeElement();
|
||||
return new AnnotationTypeMemberWriter(classWriter, te, AnnotationTypeMemberWriter.Kind.ANY);
|
||||
}
|
||||
|
||||
public AnnotationTypeMemberWriter getAnnotationTypeOptionalMemberWriter(
|
||||
ClassWriter classWriter) {
|
||||
TypeElement te = classWriter.getTypeElement();
|
||||
return new AnnotationTypeMemberWriter(classWriter, te, AnnotationTypeMemberWriter.Kind.OPTIONAL);
|
||||
}
|
||||
|
||||
public AnnotationTypeMemberWriter getAnnotationTypeRequiredMemberWriter(
|
||||
ClassWriter classWriter) {
|
||||
TypeElement te = classWriter.getTypeElement();
|
||||
return new AnnotationTypeMemberWriter(classWriter, te, AnnotationTypeMemberWriter.Kind.REQUIRED);
|
||||
}
|
||||
|
||||
public EnumConstantWriter getEnumConstantWriter(ClassWriter classWriter) {
|
||||
return new EnumConstantWriter(classWriter);
|
||||
}
|
||||
|
||||
public FieldWriter getFieldWriter(ClassWriter classWriter) {
|
||||
return new FieldWriter(classWriter);
|
||||
}
|
||||
|
||||
public PropertyWriter getPropertyWriter(ClassWriter classWriter) {
|
||||
return new PropertyWriter(classWriter);
|
||||
}
|
||||
|
||||
public MethodWriter getMethodWriter(ClassWriter classWriter) {
|
||||
return new MethodWriter(classWriter);
|
||||
}
|
||||
|
||||
public ConstructorWriter getConstructorWriter(ClassWriter classWriter) {
|
||||
return new ConstructorWriter(classWriter);
|
||||
}
|
||||
|
||||
public AbstractMemberWriter getMemberSummaryWriter(ClassWriter classWriter,
|
||||
VisibleMemberTable.Kind memberType) {
|
||||
switch (memberType) {
|
||||
case CONSTRUCTORS:
|
||||
return getConstructorWriter(classWriter);
|
||||
case ENUM_CONSTANTS:
|
||||
return getEnumConstantWriter(classWriter);
|
||||
case ANNOTATION_TYPE_MEMBER_OPTIONAL:
|
||||
return getAnnotationTypeOptionalMemberWriter(classWriter);
|
||||
case ANNOTATION_TYPE_MEMBER_REQUIRED:
|
||||
return getAnnotationTypeRequiredMemberWriter(classWriter);
|
||||
case FIELDS:
|
||||
return getFieldWriter(classWriter);
|
||||
case PROPERTIES:
|
||||
return getPropertyWriter(classWriter);
|
||||
case NESTED_CLASSES:
|
||||
return new NestedClassWriter(classWriter, classWriter.getTypeElement());
|
||||
case METHODS:
|
||||
return getMethodWriter(classWriter);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public SerializedFormWriter getSerializedFormWriter() {
|
||||
return new SerializedFormWriter(configuration);
|
||||
}
|
||||
|
||||
public DocFilesHandler getDocFilesHandler(Element element) {
|
||||
return new DocFilesHandler(configuration, element);
|
||||
}
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.ConstantsSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
|
||||
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
||||
/**
|
||||
* The factory that returns HTML writers.
|
||||
*/
|
||||
public class WriterFactoryImpl implements WriterFactory {
|
||||
|
||||
private final HtmlConfiguration configuration;
|
||||
public WriterFactoryImpl(HtmlConfiguration configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstantsSummaryWriter getConstantsSummaryWriter() {
|
||||
return new ConstantsSummaryWriterImpl(configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageSummaryWriter getPackageSummaryWriter(PackageElement packageElement) {
|
||||
return new PackageWriterImpl(configuration, packageElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModuleSummaryWriter getModuleSummaryWriter(ModuleElement mdle) {
|
||||
return new ModuleWriterImpl(configuration, mdle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassWriter getClassWriter(TypeElement typeElement, ClassTree classTree) {
|
||||
return new ClassWriterImpl(configuration, typeElement, classTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationTypeMemberWriterImpl getAnnotationTypeMemberWriter(
|
||||
ClassWriter classWriter) {
|
||||
TypeElement te = classWriter.getTypeElement();
|
||||
return new AnnotationTypeMemberWriterImpl(
|
||||
(ClassWriterImpl) classWriter, te, AnnotationTypeMemberWriterImpl.Kind.ANY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationTypeMemberWriterImpl getAnnotationTypeOptionalMemberWriter(
|
||||
ClassWriter classWriter) {
|
||||
TypeElement te = classWriter.getTypeElement();
|
||||
return new AnnotationTypeMemberWriterImpl(
|
||||
(ClassWriterImpl) classWriter, te, AnnotationTypeMemberWriterImpl.Kind.OPTIONAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationTypeMemberWriterImpl getAnnotationTypeRequiredMemberWriter(
|
||||
ClassWriter classWriter) {
|
||||
TypeElement te = classWriter.getTypeElement();
|
||||
return new AnnotationTypeMemberWriterImpl(
|
||||
(ClassWriterImpl) classWriter, te, AnnotationTypeMemberWriterImpl.Kind.REQUIRED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter) {
|
||||
return new EnumConstantWriterImpl((ClassWriterImpl) classWriter,
|
||||
classWriter.getTypeElement());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldWriterImpl getFieldWriter(ClassWriter classWriter) {
|
||||
return new FieldWriterImpl((ClassWriterImpl) classWriter, classWriter.getTypeElement());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter) {
|
||||
return new PropertyWriterImpl((ClassWriterImpl) classWriter,
|
||||
classWriter.getTypeElement());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodWriterImpl getMethodWriter(ClassWriter classWriter) {
|
||||
return new MethodWriterImpl((ClassWriterImpl) classWriter, classWriter.getTypeElement());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter) {
|
||||
return new ConstructorWriterImpl((ClassWriterImpl) classWriter,
|
||||
classWriter.getTypeElement());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberSummaryWriter getMemberSummaryWriter(ClassWriter classWriter,
|
||||
VisibleMemberTable.Kind memberType) {
|
||||
switch (memberType) {
|
||||
case CONSTRUCTORS:
|
||||
return getConstructorWriter(classWriter);
|
||||
case ENUM_CONSTANTS:
|
||||
return getEnumConstantWriter(classWriter);
|
||||
case ANNOTATION_TYPE_MEMBER_OPTIONAL:
|
||||
return getAnnotationTypeOptionalMemberWriter(classWriter);
|
||||
case ANNOTATION_TYPE_MEMBER_REQUIRED:
|
||||
return getAnnotationTypeRequiredMemberWriter(classWriter);
|
||||
case FIELDS:
|
||||
return getFieldWriter(classWriter);
|
||||
case PROPERTIES:
|
||||
return getPropertyWriter(classWriter);
|
||||
case NESTED_CLASSES:
|
||||
return new NestedClassWriterImpl((SubWriterHolderWriter)
|
||||
classWriter, classWriter.getTypeElement());
|
||||
case METHODS:
|
||||
return getMethodWriter(classWriter);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerializedFormWriter getSerializedFormWriter() {
|
||||
return new SerializedFormWriterImpl(configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocFilesHandler getDocFilesHandler(Element element) {
|
||||
return new DocFilesHandlerImpl(configuration, element);
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Objects;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* Class for generating a comment for HTML pages of javadoc output.
|
||||
|
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/ContentBuilder.java
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/ContentBuilder.java
@ -31,7 +31,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* A sequence of Content nodes.
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
@ -34,7 +34,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
|
||||
|
@ -39,7 +39,7 @@ import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr.Role;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* A tree node representing an HTML element, containing the name of the element,
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
||||
|
@ -28,7 +28,7 @@ package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* Class for generating raw HTML content to be added to HTML pages of javadoc output.
|
||||
|
@ -28,8 +28,7 @@ package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* A builder for HTML script elements.
|
||||
@ -165,7 +164,7 @@ public class Script {
|
||||
sb.append("\\\"");
|
||||
break;
|
||||
case '\'':
|
||||
sb.append("\\\'");
|
||||
sb.append("\\'");
|
||||
break;
|
||||
case '\\':
|
||||
sb.append("\\\\");
|
||||
|
@ -28,7 +28,7 @@ package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* Class for containing immutable string content for HTML tags of javadoc output.
|
||||
|
@ -28,7 +28,7 @@ package jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* Class for generating string content for HTML tags of javadoc output.
|
||||
|
@ -33,7 +33,7 @@ import com.sun.source.doctree.DocTree;
|
||||
|
||||
import jdk.javadoc.doclet.Taglet.Location;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
@ -38,7 +38,7 @@ import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
|
||||
/**
|
||||
|
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DocRootTaglet.java
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DocRootTaglet.java
@ -34,7 +34,7 @@ import com.sun.source.doctree.DocTree;
|
||||
import jdk.javadoc.doclet.Taglet;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* An inline taglet representing {@code {@docRoot}}. This taglet is
|
||||
|
@ -35,7 +35,7 @@ import com.sun.source.doctree.TextTree;
|
||||
|
||||
import jdk.javadoc.doclet.Taglet;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* An inline taglet used to index a word or a phrase.
|
||||
|
@ -39,7 +39,7 @@ import com.sun.source.util.DocTreePath;
|
||||
|
||||
import jdk.javadoc.doclet.Taglet.Location;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder.Result;
|
||||
|
@ -43,12 +43,12 @@ import com.sun.source.doctree.LinkTree;
|
||||
import com.sun.source.util.DocTreePath;
|
||||
|
||||
import jdk.javadoc.doclet.Taglet;
|
||||
import jdk.javadoc.internal.doclets.formats.html.ClassWriterImpl;
|
||||
import jdk.javadoc.internal.doclets.formats.html.ClassWriter;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlLinkInfo;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
@ -237,7 +237,7 @@ public class LinkTaglet extends BaseTaglet {
|
||||
// documented, this must be an inherited link. Redirect it.
|
||||
// The current class either overrides the referenced member or
|
||||
// inherits it automatically.
|
||||
if (htmlWriter instanceof ClassWriterImpl cw) {
|
||||
if (htmlWriter instanceof ClassWriter cw) {
|
||||
containing = cw.getTypeElement();
|
||||
} else if (!utils.isPublic(containing)) {
|
||||
reportWarning.accept("doclet.link.see.reference_not_accessible",
|
||||
|
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LiteralTaglet.java
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LiteralTaglet.java
@ -36,7 +36,7 @@ import jdk.javadoc.doclet.Taglet;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* An inline taglet used to denote literal text, possibly in monospace font.
|
||||
|
@ -46,7 +46,7 @@ import jdk.javadoc.internal.doclets.formats.html.HtmlIds;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
@ -43,7 +43,7 @@ import jdk.javadoc.internal.doclets.formats.html.Contents;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
|
@ -39,15 +39,15 @@ import com.sun.source.doctree.DocTree;
|
||||
import com.sun.source.doctree.SeeTree;
|
||||
|
||||
import jdk.javadoc.doclet.Taglet;
|
||||
import jdk.javadoc.internal.doclets.formats.html.ClassWriterImpl;
|
||||
import jdk.javadoc.internal.doclets.formats.html.ClassWriter;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Contents;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter;
|
||||
import jdk.javadoc.internal.doclets.formats.html.SerializedFormWriter;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.SerializedFormBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
@ -107,7 +107,7 @@ public class SeeTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
links.add(seeTagOutput(holder, dt));
|
||||
}
|
||||
if (utils.isVariableElement(holder) && ((VariableElement)holder).getConstantValue() != null &&
|
||||
htmlWriter instanceof ClassWriterImpl classWriter) {
|
||||
htmlWriter instanceof ClassWriter classWriter) {
|
||||
//Automatically add link to constant values page for constant fields.
|
||||
DocPath constantsPath =
|
||||
htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES);
|
||||
@ -120,8 +120,8 @@ public class SeeTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
}
|
||||
if (utils.isClass(holder) && utils.isSerializable((TypeElement)holder)) {
|
||||
//Automatically add link to serialized form page for serializable classes.
|
||||
if (SerializedFormBuilder.serialInclude(utils, holder) &&
|
||||
SerializedFormBuilder.serialInclude(utils, utils.containingPackage(holder))) {
|
||||
if (SerializedFormWriter.serialInclude(utils, holder) &&
|
||||
SerializedFormWriter.serialInclude(utils, utils.containingPackage(holder))) {
|
||||
DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM);
|
||||
DocLink link = serialPath.fragment(utils.getFullyQualifiedName(holder));
|
||||
links.add(htmlWriter.links.createLink(link,
|
||||
|
@ -36,14 +36,13 @@ import javax.lang.model.element.ExecutableElement;
|
||||
|
||||
import com.sun.source.doctree.BlockTagTree;
|
||||
import com.sun.source.doctree.DocTree;
|
||||
import com.sun.source.doctree.UnknownBlockTagTree;
|
||||
|
||||
import jdk.javadoc.doclet.Taglet;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||
|
||||
/**
|
||||
@ -184,7 +183,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
if (header == null || tags.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return simpleBlockTagOutput(holder, tags, header, tagletWriter);
|
||||
return simpleBlockTagOutput(holder, tags, header);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,8 +197,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
*/
|
||||
private Content simpleBlockTagOutput(Element element,
|
||||
List<? extends DocTree> simpleTags,
|
||||
String header,
|
||||
TagletWriter writer) {
|
||||
String header) {
|
||||
var ch = utils.getCommentHelper(element);
|
||||
var context = tagletWriter.context;
|
||||
var htmlWriter = tagletWriter.htmlWriter;
|
||||
|
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SnippetTaglet.java
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SnippetTaglet.java
@ -59,7 +59,7 @@ import jdk.javadoc.internal.doclets.formats.html.taglets.snippet.ParseException;
|
||||
import jdk.javadoc.internal.doclets.formats.html.taglets.snippet.Parser;
|
||||
import jdk.javadoc.internal.doclets.formats.html.taglets.snippet.Style;
|
||||
import jdk.javadoc.internal.doclets.formats.html.taglets.snippet.StyledText;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletElement;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
@ -46,7 +46,7 @@ import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SummaryTaglet.java
2
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SummaryTaglet.java
@ -34,7 +34,7 @@ import com.sun.source.doctree.SummaryTree;
|
||||
|
||||
import jdk.javadoc.doclet.Taglet.Location;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* A taglet that represents the {@code {@summary}} tag.
|
||||
|
@ -35,7 +35,7 @@ import com.sun.source.doctree.SystemPropertyTree;
|
||||
import jdk.javadoc.doclet.Taglet;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* A taglet that represents the {@code @systemProperty} tag.
|
||||
|
@ -31,7 +31,7 @@ import javax.lang.model.element.Element;
|
||||
import com.sun.source.doctree.DocTree;
|
||||
import jdk.javadoc.doclet.Taglet.Location;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* This is the taglet interface used internally within the doclet.
|
||||
|
@ -54,7 +54,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.taglets.Taglet.UnsupportedTagletOperationException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.DocletElement;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
|
@ -59,7 +59,7 @@ import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlLinkInfo;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||
|
@ -33,7 +33,7 @@ import javax.lang.model.element.Element;
|
||||
import com.sun.source.doctree.DocTree;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
|
||||
/**
|
||||
* A taglet wrapper, allows the public taglet {@link jdk.javadoc.doclet.Taglet}
|
||||
|
@ -41,7 +41,7 @@ import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
|
||||
import jdk.javadoc.internal.doclets.formats.html.HtmlLinkInfo;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
|
||||
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.formats.html.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||
|
||||
/**
|
||||
|
@ -35,8 +35,6 @@ import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.doclet.Doclet;
|
||||
import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.UncheckedDocletException;
|
||||
@ -193,13 +191,7 @@ public abstract class AbstractDoclet implements Doclet {
|
||||
* @param classTree the data structure representing the class tree
|
||||
* @throws DocletException if there is a problem while generating the documentation
|
||||
*/
|
||||
protected void generateOtherFiles(ClassTree classTree) throws DocletException {
|
||||
BuilderFactory builderFactory = configuration.getBuilderFactory();
|
||||
AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuilder();
|
||||
constantsSummaryBuilder.build();
|
||||
AbstractBuilder serializedFormBuilder = builderFactory.getSerializedFormBuilder();
|
||||
serializedFormBuilder.build();
|
||||
}
|
||||
protected void generateOtherFiles(ClassTree classTree) throws DocletException { }
|
||||
|
||||
/**
|
||||
* Generate the module documentation.
|
||||
|
119
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeMemberWriter.java
119
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeMemberWriter.java
@ -1,119 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
|
||||
/**
|
||||
* The interface for writing annotation type required member output.
|
||||
*/
|
||||
public interface AnnotationTypeMemberWriter extends MemberWriter {
|
||||
|
||||
/**
|
||||
* Adds the annotation type member header.
|
||||
*
|
||||
* @return the content for the member header
|
||||
*/
|
||||
Content getMemberHeader();
|
||||
|
||||
/**
|
||||
* Adds the annotation type details marker.
|
||||
*
|
||||
* @param memberDetails the content representing details marker
|
||||
*/
|
||||
void addAnnotationDetailsMarker(Content memberDetails);
|
||||
|
||||
/**
|
||||
* Adds the annotation type details header.
|
||||
*
|
||||
* @return the content for the annotation details header
|
||||
*/
|
||||
Content getAnnotationDetailsHeader();
|
||||
|
||||
/**
|
||||
* Gets the annotation type documentation header.
|
||||
*
|
||||
* @param member the annotation type being documented
|
||||
* @return the content for the annotation type documentation header
|
||||
*/
|
||||
Content getAnnotationHeaderContent(Element member);
|
||||
|
||||
/**
|
||||
* Gets 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 annotationDetailsHeader, Content annotationDetails);
|
||||
|
||||
/**
|
||||
* {@return the signature for the specified member}
|
||||
*
|
||||
* @param member the member being documented
|
||||
*/
|
||||
Content getSignature(Element member);
|
||||
|
||||
/**
|
||||
* Adds the deprecated output for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param target the content to which the deprecated information will be added
|
||||
*/
|
||||
void addDeprecated(Element member, Content target);
|
||||
|
||||
/**
|
||||
* Adds the preview output for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param content the content to which the preview information will be added
|
||||
*/
|
||||
void addPreview(Element member, Content content);
|
||||
|
||||
/**
|
||||
* Adds the comments for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param annotationContent the content to which the comments will be added
|
||||
*/
|
||||
void addComments(Element member, Content annotationContent);
|
||||
|
||||
/**
|
||||
* Adds the tags for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param annotationContent the content to which the tags will be added
|
||||
*/
|
||||
void addTags(Element member, Content annotationContent);
|
||||
|
||||
/**
|
||||
* Adds the default value documentation if the member has one.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param annotationContent the content to which the default value will be added
|
||||
*/
|
||||
void addDefaultValueInfo(Element member, Content annotationContent);
|
||||
}
|
@ -60,7 +60,6 @@ import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.doclet.Reporter;
|
||||
import jdk.javadoc.doclet.StandardDoclet;
|
||||
import jdk.javadoc.doclet.Taglet;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Comparators;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileFactory;
|
||||
@ -87,11 +86,6 @@ public abstract class BaseConfiguration {
|
||||
*/
|
||||
public final Doclet doclet;
|
||||
|
||||
/**
|
||||
* The factory for builders.
|
||||
*/
|
||||
protected BuilderFactory builderFactory;
|
||||
|
||||
/**
|
||||
* The meta tag keywords instance.
|
||||
*/
|
||||
@ -249,18 +243,6 @@ public abstract class BaseConfiguration {
|
||||
includedTypeElements = Collections.unmodifiableSet(includedSplitter.tset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder factory for this doclet.
|
||||
*
|
||||
* @return the builder factory for this doclet.
|
||||
*/
|
||||
public BuilderFactory getBuilderFactory() {
|
||||
if (builderFactory == null) {
|
||||
builderFactory = new BuilderFactory(this);
|
||||
}
|
||||
return builderFactory;
|
||||
}
|
||||
|
||||
public Reporter getReporter() {
|
||||
return this.reporter;
|
||||
}
|
||||
@ -482,13 +464,6 @@ public abstract class BaseConfiguration {
|
||||
return !(utils.isDeprecated(te) || utils.isDeprecated(utils.containingPackage(te)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the doclet specific instance of a writer factory.
|
||||
*
|
||||
* @return the {@link WriterFactory} for the doclet.
|
||||
*/
|
||||
public abstract WriterFactory getWriterFactory();
|
||||
|
||||
/**
|
||||
* Return the Locale for this document.
|
||||
*
|
||||
|
@ -1,228 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
|
||||
/**
|
||||
* The interface for writing class output.
|
||||
*/
|
||||
public interface ClassWriter {
|
||||
/**
|
||||
* Returns an instance of an output object.
|
||||
*
|
||||
* @return an instance of an output object
|
||||
*/
|
||||
Content getOutputInstance();
|
||||
|
||||
/**
|
||||
* Get the header of the page.
|
||||
*
|
||||
* @param header the header string to write
|
||||
* @return header content that needs to be added to the documentation
|
||||
*/
|
||||
Content getHeader(String header);
|
||||
|
||||
/**
|
||||
* Get the class content header.
|
||||
*
|
||||
* @return class content header that needs to be added to the documentation
|
||||
*/
|
||||
Content getClassContentHeader();
|
||||
|
||||
/**
|
||||
* Add the class inheritance tree documentation.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addClassTree(Content target);
|
||||
|
||||
/**
|
||||
* Add the type parameter and state component information.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addParamInfo(Content target);
|
||||
|
||||
/**
|
||||
* Add all superinterfaces if this is an interface.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addSuperInterfacesInfo(Content target);
|
||||
|
||||
/**
|
||||
* Add all implemented interfaces if this is a class.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addImplementedInterfacesInfo(Content target);
|
||||
|
||||
/**
|
||||
* Add all the classes that extend this one.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addSubClassInfo(Content target);
|
||||
|
||||
/**
|
||||
* Add all the interfaces that extend this one.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addSubInterfacesInfo(Content target);
|
||||
|
||||
/**
|
||||
* If this is an interface, add all classes that implement this
|
||||
* interface.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addInterfaceUsageInfo(Content target);
|
||||
|
||||
/**
|
||||
* If this is an functional interface, display appropriate message.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addFunctionalInterfaceInfo(Content target);
|
||||
|
||||
/**
|
||||
* If this is an inner class or interface, add the enclosing class or
|
||||
* interface.
|
||||
*
|
||||
* @param target the content to which the documentation will be added
|
||||
*/
|
||||
void addNestedClassInfo(Content target);
|
||||
|
||||
/**
|
||||
* {@return the class information}
|
||||
*
|
||||
* @param classInfo the class information
|
||||
*/
|
||||
Content getClassInfo(Content classInfo);
|
||||
|
||||
/**
|
||||
* If this class is deprecated, add the appropriate information.
|
||||
*
|
||||
* @param classInfo the content to which the documentation will be added
|
||||
*/
|
||||
void addClassDeprecationInfo(Content classInfo);
|
||||
|
||||
/**
|
||||
* Add the signature of the current class content.
|
||||
*
|
||||
* @param classInfo the class content to which the signature will be added
|
||||
*/
|
||||
void addClassSignature(Content classInfo);
|
||||
|
||||
/**
|
||||
* Build the class description.
|
||||
*
|
||||
* @param classInfo the content to which the documentation will be added
|
||||
*/
|
||||
void addClassDescription(Content classInfo);
|
||||
|
||||
/**
|
||||
* Add the tag information for the current class.
|
||||
*
|
||||
* @param classInfo the content to which the tag information will be added
|
||||
*/
|
||||
void addClassTagInfo(Content classInfo);
|
||||
|
||||
/**
|
||||
* Returns a list to be used for the list of summaries for members of a given kind.
|
||||
*
|
||||
* @return a list to be used for the list of summaries for members of a given kind
|
||||
*/
|
||||
Content getSummariesList();
|
||||
|
||||
/**
|
||||
* Returns an item for the list of summaries for members of a given kind.
|
||||
*
|
||||
* @param content content for the item
|
||||
* @return an item for the list of summaries for members of a given kind
|
||||
*/
|
||||
Content getSummariesListItem(Content content);
|
||||
|
||||
/**
|
||||
* Returns a list to be used for the list of details for members of a given kind.
|
||||
*
|
||||
* @return a list to be used for the list of details for members of a given kind
|
||||
*/
|
||||
Content getDetailsList();
|
||||
|
||||
/**
|
||||
* Returns an item for the list of details for members of a given kind.
|
||||
*
|
||||
* @param content content for the item
|
||||
* @return an item for the list of details for members of a given kind
|
||||
*/
|
||||
Content getDetailsListItem(Content content);
|
||||
|
||||
/**
|
||||
* Add the class content.
|
||||
*
|
||||
* @param classContent the class content which will be added to the content
|
||||
*/
|
||||
void addClassContent(Content classContent);
|
||||
|
||||
/**
|
||||
* Add the footer of the page.
|
||||
*/
|
||||
void addFooter();
|
||||
|
||||
/**
|
||||
* Print the 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 content) throws DocFileIOException;
|
||||
|
||||
/**
|
||||
* Return the TypeElement being documented.
|
||||
*
|
||||
* @return the TypeElement being documented.
|
||||
*/
|
||||
TypeElement getTypeElement();
|
||||
|
||||
/**
|
||||
* {@return the member summary}
|
||||
*
|
||||
* @param memberContent the content used to build the summary
|
||||
*/
|
||||
Content getMemberSummary(Content memberContent);
|
||||
|
||||
/**
|
||||
* {@return the member details}
|
||||
*
|
||||
* @param memberContent the content used to generate the member details
|
||||
*/
|
||||
Content getMemberDetails(Content memberContent);
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
|
||||
/**
|
||||
* The interface for writing constants summary output.
|
||||
*/
|
||||
public interface ConstantsSummaryWriter {
|
||||
|
||||
/**
|
||||
* Get the header for the constant summary documentation.
|
||||
*
|
||||
* @return header that needs to be added to the documentation
|
||||
*/
|
||||
Content getHeader();
|
||||
|
||||
/**
|
||||
* Get the header for the constant content list.
|
||||
*
|
||||
* @return content header that needs to be added to the documentation
|
||||
*/
|
||||
Content getContentsHeader();
|
||||
|
||||
/**
|
||||
* Adds the given package name link to the constant content list.
|
||||
*
|
||||
* @param abbrevPackageName the abbreviated package name
|
||||
* @param content the content to which the link will be added
|
||||
*/
|
||||
void addLinkToPackageContent(String abbrevPackageName, Content content);
|
||||
|
||||
/**
|
||||
* Add the content list to the documentation.
|
||||
*
|
||||
* @param content the content that will be added to the list
|
||||
*/
|
||||
void addContentsList(Content content);
|
||||
|
||||
/**
|
||||
* Get the constant summaries for the document.
|
||||
*
|
||||
* @return constant summaries header to be added to the documentation
|
||||
*/
|
||||
Content getConstantSummaries();
|
||||
|
||||
/**
|
||||
* Adds a header for the given abbreviated package name.
|
||||
*
|
||||
* @param abbrevPackageName the abbreviated package name
|
||||
* @param toContent the summaries documentation
|
||||
*/
|
||||
void addPackageGroup(String abbrevPackageName, Content toContent);
|
||||
|
||||
/**
|
||||
* Get the class summary header for the constants summary.
|
||||
*
|
||||
* @return the header content for the class constants summary
|
||||
*/
|
||||
Content getClassConstantHeader();
|
||||
|
||||
/**
|
||||
* Add the content list to the documentation summaries.
|
||||
*
|
||||
* @param fromClassConstant the class constant content that will be added to the list
|
||||
*/
|
||||
void addClassConstant(Content fromClassConstant);
|
||||
|
||||
/**
|
||||
* Adds the constant member table to the documentation.
|
||||
*
|
||||
* @param typeElement the class whose constants are being documented.
|
||||
* @param fields the constants being documented.
|
||||
* @param target the content to which the constant member
|
||||
* table content will be added
|
||||
*/
|
||||
void addConstantMembers(TypeElement typeElement, Collection<VariableElement> fields,
|
||||
Content target);
|
||||
|
||||
/**
|
||||
* Add the summaries list to the content.
|
||||
*
|
||||
* @param content the summaries content that will be added to the list
|
||||
*/
|
||||
void addConstantSummaries(Content content);
|
||||
|
||||
/**
|
||||
* Adds the footer for the summary documentation.
|
||||
*/
|
||||
void addFooter();
|
||||
|
||||
/**
|
||||
* Print the constants summary document.
|
||||
*
|
||||
* @param content the content which should be printed
|
||||
* @throws DocFileIOException if there is a problem while writing the document
|
||||
*/
|
||||
void printDocument(Content content) throws DocFileIOException;
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
|
||||
/**
|
||||
* The interface for writing constructor output.
|
||||
*/
|
||||
public interface ConstructorWriter extends MemberWriter {
|
||||
|
||||
/**
|
||||
* {@return the constructor details header}
|
||||
*
|
||||
* @param content the content representing member details
|
||||
*/
|
||||
Content getConstructorDetailsHeader(Content content);
|
||||
|
||||
/**
|
||||
* {@return the constructor documentation header}
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
*/
|
||||
Content getConstructorHeaderContent(ExecutableElement constructor);
|
||||
|
||||
/**
|
||||
* {@return the signature for the given constructor}
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
*/
|
||||
Content getSignature(ExecutableElement constructor);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given constructor.
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
* @param constructorContent the content to which the deprecated information will be added
|
||||
*/
|
||||
void addDeprecated(ExecutableElement constructor, Content constructorContent);
|
||||
|
||||
/**
|
||||
* Add the preview output for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param content the content to which the preview information will be added
|
||||
*/
|
||||
void addPreview(ExecutableElement member, Content content);
|
||||
|
||||
/**
|
||||
* Add the comments for the given constructor.
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
* @param constructorContent the content to which the comments will be added
|
||||
*/
|
||||
void addComments(ExecutableElement constructor, Content constructorContent);
|
||||
|
||||
/**
|
||||
* Add the tags for the given constructor.
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
* @param constructorContent the content to which the tags will be added
|
||||
*/
|
||||
void addTags(ExecutableElement constructor, Content constructorContent);
|
||||
|
||||
/**
|
||||
* {@return the constructor details}
|
||||
*
|
||||
* @param memberDetailsHeader the content representing member details header
|
||||
* @param memberDetails the content representing member details
|
||||
*/
|
||||
Content getConstructorDetails(Content memberDetailsHeader, Content memberDetails);
|
||||
|
||||
/**
|
||||
* Let the writer know whether a non public constructor was found.
|
||||
*
|
||||
* @param foundNonPubConstructor true if we found a non public constructor.
|
||||
*/
|
||||
void setFoundNonPubConstructor(boolean foundNonPubConstructor);
|
||||
|
||||
/**
|
||||
* @return the member header}
|
||||
*/
|
||||
Content getMemberHeader();
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
|
||||
/**
|
||||
* The interface for copying doc-files to the output.
|
||||
*/
|
||||
public interface DocFilesHandler {
|
||||
void copyDocFiles() throws DocletException;
|
||||
List<DocPath> getStylesheets() throws DocletException;
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
/**
|
||||
* The interface for writing enum constant output.
|
||||
*/
|
||||
public interface EnumConstantWriter extends MemberWriter {
|
||||
|
||||
/**
|
||||
* Get the enum constants details header.
|
||||
*
|
||||
* @param typeElement the class being documented
|
||||
* @param memberDetails the content representing member details
|
||||
* @return a content for the enum constants details header
|
||||
*/
|
||||
Content getEnumConstantsDetailsHeader(TypeElement typeElement,
|
||||
Content memberDetails);
|
||||
|
||||
/**
|
||||
* Get the enum constants documentation header.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @param enumConstantsDetails the content representing enum constant details
|
||||
* @return the enum constant documentation header
|
||||
*/
|
||||
Content getEnumConstantsHeader(VariableElement enumConstant,
|
||||
Content enumConstantsDetails);
|
||||
|
||||
/**
|
||||
* Get the signature for the given enum constant.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @return the enum constant signature
|
||||
*/
|
||||
Content getSignature(VariableElement enumConstant);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given enum constant.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @param content the content to which the deprecated information will be added
|
||||
*/
|
||||
void addDeprecated(VariableElement enumConstant, Content content);
|
||||
|
||||
/**
|
||||
* Add the preview output for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param content the content to which the preview information will be added
|
||||
*/
|
||||
void addPreview(VariableElement member, Content content);
|
||||
|
||||
/**
|
||||
* Add the comments for the given enum constant.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @param enumConstants the content to which the comments will be added
|
||||
*/
|
||||
void addComments(VariableElement enumConstant, Content enumConstants);
|
||||
|
||||
/**
|
||||
* Add the tags for the given enum constant.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @param content the content to which the tags will be added
|
||||
*/
|
||||
void addTags(VariableElement enumConstant, Content content);
|
||||
|
||||
/**
|
||||
* Get the enum constants details.
|
||||
*
|
||||
* @param memberDetailsHeader member details header
|
||||
* @param content the content representing member details
|
||||
* @return the enum constant details
|
||||
*/
|
||||
Content getEnumConstantsDetails(Content memberDetailsHeader, Content content);
|
||||
|
||||
/**
|
||||
* Gets the member header.
|
||||
*
|
||||
* @return the member header
|
||||
*/
|
||||
Content getMemberHeader();
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
/**
|
||||
* The interface for writing field output.
|
||||
*/
|
||||
public interface FieldWriter extends MemberWriter {
|
||||
|
||||
/**
|
||||
* Get the field details header.
|
||||
*
|
||||
* @param content the content representing member details
|
||||
* @return the field details header
|
||||
*/
|
||||
Content getFieldDetailsHeader(Content content);
|
||||
|
||||
/**
|
||||
* Get the field documentation header.
|
||||
*
|
||||
* @param field the constructor being documented
|
||||
* @return the field documentation header
|
||||
*/
|
||||
Content getFieldHeaderContent(VariableElement field);
|
||||
|
||||
/**
|
||||
* Get the signature for the given field.
|
||||
*
|
||||
* @param field the field being documented
|
||||
* @return the field signature
|
||||
*/
|
||||
Content getSignature(VariableElement field);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given field.
|
||||
*
|
||||
* @param field the field being documented
|
||||
* @param fieldContent the content to which the deprecated information will be added
|
||||
*/
|
||||
void addDeprecated(VariableElement field, Content fieldContent);
|
||||
|
||||
/**
|
||||
* Adds the preview output for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param content the content to which the preview information will be added
|
||||
*/
|
||||
void addPreview(VariableElement member, Content content);
|
||||
|
||||
/**
|
||||
* Add the comments for the given field.
|
||||
*
|
||||
* @param field the field being documented
|
||||
* @param fieldContent the content to which the comments will be added
|
||||
*/
|
||||
void addComments(VariableElement field, Content fieldContent);
|
||||
|
||||
/**
|
||||
* Add the tags for the given field.
|
||||
*
|
||||
* @param field the field being documented
|
||||
* @param fieldContent the content to which the tags will be added
|
||||
*/
|
||||
void addTags(VariableElement field, Content fieldContent);
|
||||
|
||||
/**
|
||||
* Get 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 memberDetailsHeaderContent, Content memberContent);
|
||||
|
||||
/**
|
||||
* Gets the member header.
|
||||
*
|
||||
* @return the member header
|
||||
*/
|
||||
Content getMemberHeader();
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import com.sun.source.doctree.DocTree;
|
||||
|
||||
/**
|
||||
* The interface for writing member summary output.
|
||||
*/
|
||||
public interface MemberSummaryWriter {
|
||||
|
||||
/**
|
||||
* Returns the member summary header for the given class.
|
||||
*
|
||||
* @param typeElement the class the summary belongs to
|
||||
* @param content the content to which the member summary will be added
|
||||
*
|
||||
* @return the member summary header
|
||||
*/
|
||||
Content getMemberSummaryHeader(TypeElement typeElement, Content content);
|
||||
|
||||
/**
|
||||
* Returns the summary table for the given class.
|
||||
*
|
||||
* @param typeElement the class the summary table belongs to
|
||||
*
|
||||
* @return the summary table
|
||||
*/
|
||||
Content getSummaryTable(TypeElement typeElement);
|
||||
|
||||
/**
|
||||
* Adds the member summary for the given class and member.
|
||||
*
|
||||
* @param typeElement the class the summary belongs to
|
||||
* @param member the member that is documented
|
||||
* @param firstSentenceTrees the tags for the sentence being documented
|
||||
*/
|
||||
void addMemberSummary(TypeElement typeElement, Element member,
|
||||
List<? extends DocTree> firstSentenceTrees);
|
||||
|
||||
/**
|
||||
* Returns the inherited member summary header for the given class.
|
||||
*
|
||||
* @param typeElement the class the summary belongs to
|
||||
*
|
||||
* @return the inherited member summary header
|
||||
*/
|
||||
Content getInheritedSummaryHeader(TypeElement typeElement);
|
||||
|
||||
/**
|
||||
* Adds the inherited member summary for the given class and member.
|
||||
*
|
||||
* @param typeElement the class the inherited member belongs to
|
||||
* @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 content the content to which the links will be added
|
||||
*/
|
||||
void addInheritedMemberSummary(TypeElement typeElement,
|
||||
Element member, boolean isFirst, boolean isLast,
|
||||
Content content);
|
||||
|
||||
/**
|
||||
* Returns the inherited summary links.
|
||||
*
|
||||
* @return the inherited summary links
|
||||
*/
|
||||
Content getInheritedSummaryLinks();
|
||||
|
||||
/**
|
||||
* Adds the given summary to the list of summaries.
|
||||
*
|
||||
* @param summariesList the list of summaries
|
||||
* @param content the summary
|
||||
*/
|
||||
void addSummary(Content summariesList, Content content);
|
||||
|
||||
/**
|
||||
* Returns the member content.
|
||||
*
|
||||
* @param memberContent the content representing the member
|
||||
*
|
||||
* @return the member content
|
||||
*/
|
||||
Content getMember(Content memberContent);
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
/**
|
||||
* Common behavior for writing members of a type.
|
||||
*/
|
||||
public interface MemberWriter {
|
||||
|
||||
/**
|
||||
* {@return a list to add member items to}
|
||||
*
|
||||
* @see #getMemberListItem(Content)
|
||||
*/
|
||||
Content getMemberList();
|
||||
|
||||
/**
|
||||
* {@return a member item}
|
||||
*
|
||||
* @param member the member to represent as an item
|
||||
* @see #getMemberList()
|
||||
*/
|
||||
Content getMemberListItem(Content member);
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
||||
/**
|
||||
* The interface for writing method output.
|
||||
*/
|
||||
public interface MethodWriter extends MemberWriter {
|
||||
|
||||
/**
|
||||
* Get the method details header.
|
||||
*
|
||||
* @param content the content representing member details
|
||||
* @return the method details header
|
||||
*/
|
||||
Content getMethodDetailsHeader(Content content);
|
||||
|
||||
/**
|
||||
* Get the method documentation header.
|
||||
*
|
||||
* @param method the method being documented
|
||||
* @return the method documentation header
|
||||
*/
|
||||
Content getMethodHeader(ExecutableElement method);
|
||||
|
||||
/**
|
||||
* Get the signature for the given method.
|
||||
*
|
||||
* @param method the method being documented
|
||||
* @return the method signature
|
||||
*/
|
||||
Content getSignature(ExecutableElement method);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given method.
|
||||
*
|
||||
* @param method the method being documented
|
||||
* @param methodContent the content to which the deprecated information will be added
|
||||
*/
|
||||
void addDeprecated(ExecutableElement method, Content methodContent);
|
||||
|
||||
/**
|
||||
* Adds the preview output for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param content the content to which the preview information will be added
|
||||
*/
|
||||
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 methodContent the content to which the comments will be added
|
||||
*/
|
||||
void addComments(TypeMirror holder, ExecutableElement method, Content methodContent);
|
||||
|
||||
/**
|
||||
* Add the tags for the given method.
|
||||
*
|
||||
* @param method the method being documented
|
||||
* @param methodContent the content to which the tags will be added
|
||||
*/
|
||||
void addTags(ExecutableElement method, Content methodContent);
|
||||
|
||||
/**
|
||||
* Get 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 methodDetailsHeader, Content methodDetails);
|
||||
|
||||
/**
|
||||
* Gets the member header.
|
||||
*
|
||||
* @return the member header
|
||||
*/
|
||||
Content getMemberHeader();
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
|
||||
/**
|
||||
* The interface for writing module summary output.
|
||||
*/
|
||||
public interface ModuleSummaryWriter {
|
||||
|
||||
/**
|
||||
* Get the header for the summary.
|
||||
*
|
||||
* @param heading module name.
|
||||
* @return the header to be added to the content
|
||||
*/
|
||||
Content getModuleHeader(String heading);
|
||||
|
||||
/**
|
||||
* Get the header for the module content.
|
||||
*
|
||||
* @return the module content header
|
||||
*/
|
||||
Content getContentHeader();
|
||||
|
||||
/**
|
||||
* Get the header for the summary header.
|
||||
*
|
||||
* @return the summary header
|
||||
*/
|
||||
Content getSummariesList();
|
||||
|
||||
/**
|
||||
* Wrap the content into summary section.
|
||||
*
|
||||
* @param source the content to wrap into the summary section
|
||||
* @return the summary
|
||||
*/
|
||||
Content getSummary(Content source);
|
||||
|
||||
/**
|
||||
* Adds the module description.
|
||||
*
|
||||
* @param moduleContent the content to which the module description
|
||||
* will be added
|
||||
*/
|
||||
void addModuleDescription(Content moduleContent);
|
||||
|
||||
/**
|
||||
* Adds the module signature.
|
||||
*
|
||||
* @param moduleContent the content to which the module signature
|
||||
* will be added
|
||||
*/
|
||||
void addModuleSignature(Content moduleContent);
|
||||
|
||||
/**
|
||||
* Adds the summary of modules to the list of summaries.
|
||||
*
|
||||
* @param summariesList the list of summaries
|
||||
*/
|
||||
void addModulesSummary(Content summariesList);
|
||||
|
||||
/**
|
||||
* Adds the summary of packages to the list of summaries.
|
||||
*
|
||||
* @param summariesList the list of summaries
|
||||
*/
|
||||
void addPackagesSummary(Content summariesList);
|
||||
|
||||
/**
|
||||
* Adds the summary of services to the list of summaries.
|
||||
*
|
||||
* @param summariesList the list of summaries
|
||||
*/
|
||||
void addServicesSummary(Content summariesList);
|
||||
|
||||
/**
|
||||
* Adds the module content to the documentation.
|
||||
*
|
||||
* @param source the content that will be added
|
||||
*/
|
||||
void addModuleContent(Content source);
|
||||
|
||||
/**
|
||||
* Adds the footer to the documentation.
|
||||
*/
|
||||
void addModuleFooter();
|
||||
|
||||
/**
|
||||
* Print the module summary document.
|
||||
*
|
||||
* @param content the content that will be printed
|
||||
* @throws DocFileIOException if there is a problem while writing the document
|
||||
*/
|
||||
void printDocument(Content content) throws DocFileIOException;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user