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

public Class Head

extends Content
Class Inheritance
Imports
java.io.IOException, .Writer, java.time.ZonedDateTime, java.time.format.DateTimeFormatter, java.util.ArrayList, .Arrays, .List, .Locale, jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration, jdk.javadoc.internal.doclets.toolkit.util.DocPath, .DocPaths, jdk.javadoc.internal.html.Comment, .Content, .HtmlAttr, .HtmlTag, .HtmlTree, .Script

An HTML <head> element. Many methods return the current object, to facilitate fluent builder-style usage.

Field Summary

Modifier and TypeField and Description
private boolean
private List<HtmlConfiguration.JavaScriptFile>
private List<DocPath>
private DocPath
private String
private String
private final Runtime.Version
private final List<Content>
private final ZonedDateTime
private String
private boolean
private final List<String>
private List<DocPath>
private Script
private DocPath
private final DocPath
private final List<Script>
private boolean
private boolean
private String

Constructor Summary

AccessConstructor and Description
public
Head(DocPath
the path for the file that will include this HEAD element
path
,
Runtime.Version
the doclet version
docletVersion
,
ZonedDateTime generatedDate)

Creates a Head object, for a given file and HTML version.

Method Summary

Modifier and TypeMethod and Description
public Head

Returns:

this object
addContent
(Content...
the content
contents
)

Adds additional content to be included in the HEAD element.

public Head

Returns:

this object
addDefaultScript
(boolean
whether or not a default script will be included
addDefaultScript
)

Specifies whether or not to add a reference to a default script to be included in the HEAD element.

public Head

Returns:

this object
addKeywords
(List<String>
the list of keywords, or null if none need to be added
keywords
)

Adds a list of keywords to appear in META keywords elements.

public Head

Returns:

this object
addScript
(Script
the script
script
)

Adds a script to be included in the HEAD element.

private void
private void
private void
private void
addStylesheet(HtmlTree head, DocPath stylesheet)

private void
private Comment
getGeneratedBy(boolean timestamp, ZonedDateTime buildDate)

public boolean

Returns:

false
isEmpty
()

Implements abstract jdk.javadoc.internal.html.Content.isEmpty.

Returns true if the content is empty.

public Head

Returns:

this object
setAdditionalScripts
(List<HtmlConfiguration.JavaScriptFile>
the list of additional script files
scripts
)

Sets the list of additional script files to be added to the HEAD element.

public Head

Returns:

this object
setCharset
(String
the charset
charset
)

Sets the charset to be declared in a META Content-TYPE element.

public Head
setDescription(String description)

Sets the content for the description META element.

public Head
setGenerator(String generator)

Sets the content for the generator META element.

public Head

Returns:

this object
setIndex
(boolean
true if the supporting files are to be included
index
,
Script
the Script object, or null
mainBodyScript
)

Sets whether or not to include the supporting scripts and stylesheets for the "search" feature.

public Head

Returns:

this object
setStylesheets
(DocPath
the main stylesheet, or null to use the default
main
,
List<DocPath>
a list of any additional stylesheets to be included
additional
,
List<DocPath>
a list of module- or package-local stylesheets to be included
local
)

Sets the main and any additional stylesheets to be listed in the HEAD element.

public Head

Returns:

this object
setSyntaxHighlight
(boolean
true to enable syntax highligting
value
)

Enables or disables support for syntax highlighting.

public Head

Returns:

this object
setTimestamp
(boolean
true if timestamps should be be added.
timestamp
)

Sets whether or not timestamps should be recorded in the HEAD element.

public Head

Returns:

this object
setTitle
(String
the title
title
)

Sets the title to appear in the TITLE element.

private Content

Returns:

the HTML
toContent
()

Returns the HTML for the HEAD element.

public boolean
write(Writer out, String newline, boolean atNewline)

Implements abstract jdk.javadoc.internal.html.Content.write.

Writes content to a writer, using a given newline sequence, which should be either \n or the platform line separator.

Inherited from jdk.javadoc.internal.html.Content:
addaddaddAllcharCountisDiscardableisPhrasingContentstripTagstoString

Field Detail

addDefaultScriptback to summary
private boolean addDefaultScript
additionalScriptsback to summary
private List<HtmlConfiguration.JavaScriptFile> additionalScripts
additionalStylesheetsback to summary
private List<DocPath> additionalStylesheets
charsetback to summary
private String charset
descriptionback to summary
private String description
docletVersionback to summary
private final Runtime.Version docletVersion
extraContentback to summary
private final List<Content> extraContent
generatedDateback to summary
private final ZonedDateTime generatedDate
generatorback to summary
private String generator
indexback to summary
private boolean index
keywordsback to summary
private final List<String> keywords
localStylesheetsback to summary
private List<DocPath> localStylesheets
mainBodyScriptback to summary
private Script mainBodyScript
mainStylesheetback to summary
private DocPath mainStylesheet
pathToRootback to summary
private final DocPath pathToRoot
scriptsback to summary
private final List<Script> scripts
showTimestampback to summary
private boolean showTimestamp
syntaxHighlightback to summary
private boolean syntaxHighlight
titleback to summary
private String title

Constructor Detail

Headback to summary
public Head(DocPath path, Runtime.Version docletVersion, ZonedDateTime generatedDate)

Creates a Head object, for a given file and HTML version. The file is used to help determine the relative paths to stylesheet and script files. The HTML version is used to determine the appropriate form of a META element recording the time the file was created. The doclet version should also be provided for recording in the file.

Parameters
path:DocPath

the path for the file that will include this HEAD element

docletVersion:Runtime.Version

the doclet version

Method Detail

addContentback to summary
public Head addContent(Content... contents)

Adds additional content to be included in the HEAD element.

Parameters
contents:Content[]

the content

Returns:Head

this object

addDefaultScriptback to summary
public Head addDefaultScript(boolean addDefaultScript)

Specifies whether or not to add a reference to a default script to be included in the HEAD element. The default script will normally be included; this method may be used to prevent that.

Parameters
addDefaultScript:boolean

whether or not a default script will be included

Returns:Head

this object

addKeywordsback to summary
public Head addKeywords(List<String> keywords)

Adds a list of keywords to appear in META keywords elements.

Parameters
keywords:List<String>

the list of keywords, or null if none need to be added

Returns:Head

this object

addScriptback to summary
public Head addScript(Script script)

Adds a script to be included in the HEAD element.

Parameters
script:Script

the script

Returns:Head

this object

addScriptElementback to summary
private void addScriptElement(HtmlTree head, DocPath filePath)
addScriptElementback to summary
private void addScriptElement(HtmlTree head, HtmlConfiguration.JavaScriptFile script)
addScriptsback to summary
private void addScripts(HtmlTree head)
addStylesheetback to summary
private void addStylesheet(HtmlTree head, DocPath stylesheet)
addStylesheetsback to summary
private void addStylesheets(HtmlTree head)
getGeneratedByback to summary
private Comment getGeneratedBy(boolean timestamp, ZonedDateTime buildDate)
isEmptyback to summary
public boolean isEmpty()

Implements abstract jdk.javadoc.internal.html.Content.isEmpty.

Doc from jdk.javadoc.internal.html.Content.isEmpty.

Returns true if the content is empty.

Implementation Specification

This implementation always returns false.

Returns:boolean

false

Annotations
@Override
setAdditionalScriptsback to summary
public Head setAdditionalScripts(List<HtmlConfiguration.JavaScriptFile> scripts)

Sets the list of additional script files to be added to the HEAD element. The path for the script files must be relative to the root of the generated documentation hierarchy.

Parameters
scripts:List<HtmlConfiguration.JavaScriptFile>

the list of additional script files

Returns:Head

this object

setCharsetback to summary
public Head setCharset(String charset)

Sets the charset to be declared in a META Content-TYPE element.

Parameters
charset:String

the charset

Returns:Head

this object

setDescriptionback to summary
public Head setDescription(String description)

Sets the content for the description META element.

setGeneratorback to summary
public Head setGenerator(String generator)

Sets the content for the generator META element.

setIndexback to summary
public Head setIndex(boolean index, Script mainBodyScript)

Sets whether or not to include the supporting scripts and stylesheets for the "search" feature. If the feature is enabled, a Script must be provided into which some JavaScript code will be injected, to be executed during page loading. The value will be ignored if the feature is not enabled.

Parameters
index:boolean

true if the supporting files are to be included

mainBodyScript:Script

the Script object, or null

Returns:Head

this object

setStylesheetsback to summary
public Head setStylesheets(DocPath main, List<DocPath> additional, List<DocPath> local)

Sets the main and any additional stylesheets to be listed in the HEAD element. The paths for the stylesheets must be relative to the root of the generated documentation hierarchy.

Parameters
main:DocPath

the main stylesheet, or null to use the default

additional:List<DocPath>

a list of any additional stylesheets to be included

local:List<DocPath>

a list of module- or package-local stylesheets to be included

Returns:Head

this object

setSyntaxHighlightback to summary
public Head setSyntaxHighlight(boolean value)

Enables or disables support for syntax highlighting.

Parameters
value:boolean

true to enable syntax highligting

Returns:Head

this object

setTimestampback to summary
public Head setTimestamp(boolean timestamp)

Sets whether or not timestamps should be recorded in the HEAD element. The timestamp will be recorded in a comment, and in an appropriate META element, depending on the HTML version specified when this object was created.

Parameters
timestamp:boolean

true if timestamps should be be added.

Returns:Head

this object

setTitleback to summary
public Head setTitle(String title)

Sets the title to appear in the TITLE element.

Parameters
title:String

the title

Returns:Head

this object

toContentback to summary
private Content toContent()

Returns the HTML for the HEAD element.

Returns:Content

the HTML

writeback to summary
public boolean write(Writer out, String newline, boolean atNewline) throws IOException

Implements abstract jdk.javadoc.internal.html.Content.write.

Doc from jdk.javadoc.internal.html.Content.write.

Writes content to a writer, using a given newline sequence, which should be either \n or the platform line separator.

Annotations
@Override
Exceptions
IOException:
if an error occurs while writing the output