APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.javadoc.internal.doclets.formats.html

public abstract Class HtmlDocletWriter

extends Object
Class Inheritance
Known Direct Subclasses
jdk.javadoc.internal.doclets.formats.html.IndexItemListWriter, jdk.javadoc.internal.doclets.formats.html.IndexRedirectWriter, jdk.javadoc.internal.doclets.formats.html.IndexWriter, jdk.javadoc.internal.doclets.formats.html.ModuleWriter, jdk.javadoc.internal.doclets.formats.html.PackageWriter, jdk.javadoc.internal.doclets.formats.html.SearchWriter, jdk.javadoc.internal.doclets.formats.html.SubWriterHolderWriter, jdk.javadoc.internal.doclets.formats.html.ExternalSpecsWriter, jdk.javadoc.internal.doclets.formats.html.AbstractOverviewIndexWriter, jdk.javadoc.internal.doclets.formats.html.AbstractTreeWriter, jdk.javadoc.internal.doclets.formats.html.AllClassesIndexWriter, jdk.javadoc.internal.doclets.formats.html.AllPackagesIndexWriter, jdk.javadoc.internal.doclets.formats.html.ConstantsSummaryWriter, jdk.javadoc.internal.doclets.formats.html.DocFilesHandler.DocFileWriter, jdk.javadoc.internal.doclets.formats.html.HelpWriter
Imports
java.net.URI, java.util.ArrayList, .Comparator, .EnumSet, .HashMap, .HashSet, .LinkedList, .List, .ListIterator, .Locale, .Map, .Objects, .Optional, .Set, java.util.regex.Matcher, .Pattern, javax.lang.model.element.AnnotationMirror, .AnnotationValue, .Element, .ElementKind, .ExecutableElement, .ModuleElement, .Name, .PackageElement, .QualifiedNameable, .TypeElement, .VariableElement, javax.lang.model.type.ArrayType, .DeclaredType, .TypeMirror, javax.lang.model.util.SimpleAnnotationValueVisitor9, .SimpleElementVisitor14, .SimpleTypeVisitor9, com.sun.source.doctree.AttributeTree, .AttributeTree.ValueKind, .CommentTree, .DeprecatedTree, .DocRootTree, .DocTree, .DocTree.Kind, .EndElementTree, .EntityTree, .ErroneousTree, .EscapeTree, .IndexTree, .InheritDocTree, .InlineTagTree, .LinkTree, .LiteralTree, .RawTextTree, .StartElementTree, .TextTree, .UnknownBlockTagTree, com.sun.source.util.DocTreePath, .SimpleDocTreeVisitor, jdk.internal.org.commonmark.Extension, jdk.internal.org.commonmark.ext.gfm.tables.TablesExtension, jdk.internal.org.commonmark.node.AbstractVisitor, .Code, .Heading, .Node, jdk.internal.org.commonmark.parser.Parser, jdk.internal.org.commonmark.renderer.NodeRenderer, jdk.internal.org.commonmark.renderer.html.HtmlNodeRendererContext, .HtmlNodeRendererFactory, .HtmlRenderer, .HtmlWriter, jdk.javadoc.internal.doclets.formats.html.markup.Head, .HtmlDocument, .HtmlStyles, .Links, jdk.javadoc.internal.doclets.formats.html.taglets.Taglet, .TagletWriter, jdk.javadoc.internal.doclets.toolkit.DocFileElement, .DocletException, .Messages, .Resources, jdk.javadoc.internal.doclets.toolkit.util.CommentHelper, .Comparators, .DocFile, .DocFileIOException, .DocLink, .DocPath, .DocPaths, .IndexItem, .Utils, .Utils.DeclarationPreviewLanguageFeatures, .Utils.ElementFlag, .Utils.PreviewSummary, jdk.javadoc.internal.html.Content, .ContentBuilder, .Entity, .HtmlId, .HtmlStyle, .HtmlTag, .HtmlTree, .RawHtml, .Script, .Text, .TextBuilder

The base class for classes that write complete HTML pages to be included in the overall API documentation. The primary method is buildPage().

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
private boolean
protected final Comparators
public final HtmlConfiguration
configuration

The global configuration information for this run.

protected final Contents
protected final DocPaths
private static final Pattern
private final Set<String>
protected final HtmlIds
public final Map<String, Integer>
indexAnchorTable

A table of the anchors used for at-index and related tags, so that they can be made unique by appending a suitable suffix.

private boolean
isAnnotationDocumented

To check whether the repeated annotations is documented or not.

private boolean
isContainerDocumented

To check whether the container annotations is documented or not.

public final Links
protected Script
public final Messages
protected final HtmlOptions
public final DocPath
path

Platform-independent path from the current or the destination directory to the file getting generated.

public final DocPath
pathToRoot

Relative path from the file getting generated to the destination directory.

protected final Resources
protected final TableOfContents
protected final Utils
protected String
winTitle

The window title of this file.

Constructor Summary

AccessConstructor and Description
public
HtmlDocletWriter(HtmlConfiguration
the configuration for this doclet
configuration
,
DocPath
the file to be generated.
path
)

Creates an HtmlDocletWriter.

protected
HtmlDocletWriter(HtmlConfiguration
the configuration for this doclet
configuration
,
DocPath
the file to be generated.
path
,
boolean
whether to write a "Generating ..." message to the console
generating
)

Creates an HtmlDocletWriter.

Method Summary

Modifier and TypeMethod and Description
private void
addAnnotations(TypeElement
the annotation being documented
annotationDoc
,
HtmlLinkInfo
the information about the link
linkInfo
,
ContentBuilder
the annotation string to which the annotation will be added
annotation
,
Map<? extends ExecutableElement, ? extends AnnotationValue>
annotation type element to annotation value pairs
map
,
boolean
if true, add new line between each member value
linkBreak
)

Add annotation to the annotation string.

private void
addCommentTags(Element
the Element for which the comment tags will be generated
element
,
List<? extends DocTree>
the first sentence tags for the doc
tags
,
boolean
true if it is deprecated
depr
,
boolean
true if the first sentence tags should be added
first
,
boolean
true if the comment tags are added into the summary section
inSummary
,
Content
the content to which the comment tags will be added
target
)

Adds the comment tags.

public void
addInlineComment(Element
the Element for which the inline comment will be added
element
,
DocTree
the inline tag to be added
tag
,
Content
the content to which the comment will be added
target
)

Add the inline comment.

public void
addInlineComment(Element
the element for which the content will be added
element
,
Content
the content to which the content will be added
target
)

Adds the full-body content of the given element.

public void
addInlineDeprecatedComment(Element
the Element for which the inline deprecated comment will be added
e
,
DeprecatedTree
the inline tag to be added
tag
,
Content
the content to which the comment will be added
target
)

Add the inline deprecated comment.

private void
addMethodInfo(ExecutableElement
the method to be documented
method
,
Content
the content to which the method information will be added
dl
)

Add method information.

public void
addPreviewComment(Element
the Element for which the summary will be generated
element
,
List<? extends DocTree>
the first sentence tags for the doc
firstSentenceTags
,
Content
the content to which the summary will be added
target
)

Adds the preview content.

public void
addPreviewInfo(Element forWhat, Content target)

public void
public void
public void
public void
addSummaryComment(Element
the Element for which the summary will be generated
element
,
Content
the content to which the summary will be added
target
)

Adds the summary content.

public void
addSummaryComment(Element
the Element for which the summary will be generated
element
,
List<? extends DocTree>
the first sentence tags for the doc
firstSentenceTags
,
Content
the content to which the summary will be added
target
)

Adds the summary content.

public void
protected void
addTagsInfo(Element
the Element for which the tags will be generated
e
,
Content
the content to which the tags will be added
content
)

Adds the tags information.

private Content
public abstract void
buildPage()

The top-level method to generate and write the page represented by this writer.

public Content

Returns:

a Content object
commentTagsToContent
(Element
specific element where comment resides
element
,
List<? extends DocTree>
list of text trees and inline tag trees (often alternating)
tags
,
boolean
true if text is first sentence
isFirstSentence
)

Converts inline tags and text to content, expanding the inline tags along the way.

public Content

Returns:

a Content object
commentTagsToContent
(Element
specific element where comment resides
element
,
List<? extends DocTree>
list of text trees and inline tag trees (often alternating)
trees
,
boolean
true if text is first sentence
isFirstSentence
,
boolean
if the comment tags are added into the summary section
inSummary
)

Converts inline tags and text to content, expanding the inline tags along the way.

public Content

Returns:

a Content object
commentTagsToContent
(Element
specific element where comment resides
element
,
List<? extends DocTree>
list of text trees and inline tag trees (often alternating)
trees
,
TagletWriter.Context
the enclosing context for the trees
context
)

Converts inline tags and text to content, expanding the inline tags along the way.

private void
createSectionIdAndIndex(StartElementTree node, List<? extends DocTree> trees, Content attrs, Element element, TagletWriter.Context context)

protected TableOfContents

Returns:

a table of contents
createTableOfContents
()

Creates table of contents for this writer.

private boolean
pack-priv Content

Returns:

the annotation types info for the given element
getAnnotationInfo
(Element
an Element
element
,
boolean
if true add new line between each member value
lineBreak
)

Returns the annotation types info for the given element.

pack-priv Content

Returns:

the description for the given annotations
getAnnotationInfo
(List<? extends AnnotationMirror>
a list of annotation mirrors
descList
,
boolean
if true add new line between each member value
lineBreak
)

Returns the description for the given annotations.

public List<Content>

Returns:

a list of strings representing the annotations being documented.
getAnnotations
(List<? extends AnnotationMirror>
a list of annotation mirrors.
descList
,
boolean
if true, add new line between each member value.
lineBreak
)

Return the string representations of the annotation types for the given doc.

protected Content

Returns:

the content
getBlockTagOutput
(Element
the element
element
)

Returns the content generated from the default supported set of block tags for this element.

protected Content

Returns:

the content
getBlockTagOutput
(Element
the element
element
,
List<Taglet>
the taglets to handle the required set of tags
taglets
)

Returns the content generated from a specified set of block tags for this element.

public HtmlTree

Returns:

an HtmlTree for the BODY tag
getBody
(String
title for the window
title
)

Returns an HtmlTree for the BODY element.

public HtmlStyle
public TypeElement

Returns:

the type element documented by this writer if it is a ClassWriter, or null for any other kind of writer
getCurrentTypeElement
()

Returns the type element documented by this writer if it is a ClassWriter, or null for any other kind of writer.

public Content

Returns:

a phrase describing the type of deprecation
getDeprecatedPhrase
(Element
the Element for which the inline deprecated comment will be added
e
)

Returns a phrase describing the type of deprecation.

pack-priv static String

Returns:

the description
getDescription
(String
a prefix for the string
prefix
,
Element
the element
elem
)

Generates a string for use in a description meta element, based on an element and its enclosing elements

public String

Returns:

the name
getEnclosingPackageName
(TypeElement
TypeElement
te
)

Get the enclosed name of the package

public String

Returns:

the title for a doc-file element
getFileTitle
(DocFileElement
the doc-file element
element
)

Returns the title for a doc-file element.

public HtmlTree

Returns:

the <footer> element or null.
getFooter
()

Returns a <footer> element containing the user's "bottom" text, or null if there is no such text.

pack-priv static String
getGenerator(Class<?> clazz)

protected Content

Returns:

the <header> element
getHeader
(Navigation.PageMode
the pageMode used to configure the navigation bar
pageMode
)

Returns a <header> element, containing the user "top" text, if any, and the main navigation bar.

protected Content

Returns:

the <header> element
getHeader
(Navigation.PageMode
the page mode used to configure the navigation bar
pageMode
,
Element
the element used to configure the navigation bar
element
)

Returns a <header> element, containing the user "top" text, if any, and the main navigation bar.

private String

Returns:

the content of the <h1> heading in the given content, or an empty string if there is no such heading
getHeadingText
(Content
the content
c
)

Returns the content of the <h1> heading in the given content, or an empty string if there is no such heading.

private Optional<String>
private Content
public Content

Returns:

a package name
getLocalizedPackageName
(PackageElement
the package to get the name for
packageElement
)

Returns a package name.

pack-priv List<DocPath>

Returns:

list of path of module/package specific stylesheets
getLocalStylesheets
(Element
module/Package element
element
)

Returns the path of module/package specific stylesheets for the element.

private List<DocPath>
protected Navigation

Returns:

the basic navigation bar
getNavBar
(Navigation.PageMode
the page mode
pageMode
,
Element
the defining element for the navigation bar, or null if none
element
)

Returns a basic navigation bar for a kind of page and element.

protected Content

Returns:

an "overview tree" link for a navigation bar
getNavLinkToOverviewTree
(String
the label for the link
label
)

Returns an "overview tree" link for a navigation bar.

public Content

Returns:

the package name content
getPackageLabel
(CharSequence
the package name
packageName
)

Returns a package name label.

protected TableHeader
private List<Content>
private List<DocPath>
public TagletWriter

Returns:

a TagletWriter that knows how to write HTML.
getTagletWriterInstance
(boolean
true if we want to write the first sentence
isFirstSentence
)

Returns a TagletWriter that knows how to write HTML.

public TagletWriter

Returns:

a TagletWriter
getTagletWriterInstance
(TagletWriter.Context
the enclosing context
context
)

Returns a TagletWriter that knows how to write HTML.

private String

Returns:

the plain-text content of a named HTML element in a list of content
getTextContent
(List<? extends DocTree>
the list of content
trees
,
String
the name og the HTML element
name
)

Returns the plain-text content of a named HTML element in a list of content.

public String

Returns:

the window title string
getWindowTitle
(String
the title string to construct the complete window title
title
)

Returns the window title.

protected boolean

Returns:

true if and only if there are tags to be included
hasSerializationOverviewTags
(VariableElement
the field to check
field
)

Returns whether there are any tags in a field for the Serialization Overview section to be generated.

pack-priv boolean
ignoreNonInlineTag(DocTree dtree, List<Name> openTags)

private boolean
private boolean
inSamePackage(Element element)

Returns true if element lives in the same package as the type or package element of this writer.

public Content

Returns:

the output
invalidTagOutput
(String
the single-line summary message
summary
,
Optional<Content>
the optional detail message which may contain preformatted text
detail
)

Returns the output for an invalid tag.

private boolean

Returns:

true if the annotation contains an array of annotation as a value.
isAnnotationArray
(Map<? extends ExecutableElement, ? extends AnnotationValue>
annotation type element and value pairs
pairs
)

Check if the annotation contains an array of annotation as a value.

private static boolean
isBlank(String s, int start, int end)

public boolean

Returns:

true if the page written by this writer should be indexed, false otherwise
isIndexable
()

Returns true if the page written by this writer should be indexed, false otherwise.

protected DocPath
pathString(TypeElement
TypeElement for which the path is requested.
te
,
DocPath
Name of the file(doesn't include path).
name
)

Return the path to the class page for a typeElement.

protected DocPath
pathString(PackageElement
Package in which the file name is assumed to be.
packageElement
,
DocPath
File name, to which path string is.
name
)

Return path to the given file name in the given package.

public void
printHtmlDocument(List<String>
Array of String keywords for META tag. Each element of the array is assigned to a separate META tag. Pass in null for no array
metakeywords
,
String
the content for the description META tag.
description
,
Content
the body htmltree to be included in the document
body
)

Generates the HTML document tree and prints it out.

public void
printHtmlDocument(List<String>
Array of String keywords for META tag. Each element of the array is assigned to a separate META tag. Pass in null for no array
metakeywords
,
String
the content for the description META tag.
description
,
List<DocPath>
local stylesheets to be included in the HEAD element
localStylesheets
,
Content
the body htmltree to be included in the document
body
)

Generates the HTML document tree and prints it out.

public void
printHtmlDocument(List<String>
Array of String keywords for META tag. Each element of the array is assigned to a separate META tag. Pass in null for no array
metakeywords
,
String
the content for the description META tag.
description
,
Content
any additional content to be included in the HEAD element
extraHeadContent
,
List<DocPath>
local stylesheets to be included in the HEAD element
localStylesheets
,
Content
the body htmltree to be included in the document
body
)

Generates the HTML document tree and prints it out.

public String
replaceDocRootDir(String htmlstr)

Replace {@docRoot} tag used in options that accept HTML text, such as -header, -footer, -top and -bottom, and when converting a relative HREF where commentTagsToString inserts a {@docRoot} where one was missing.

public URI
private Content
withPreviewFeatures(String key, String className, String featureName, List<String> features)

protected final void
writeGenerating()

Writes a "Generating _file_" message to the console

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait