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

public Class SourceToHTMLConverter

extends Object
Class Inheritance
Imports
java.io.IOException, .LineNumberReader, .Reader, java.util.List, javax.lang.model.element.Element, .ModuleElement, .PackageElement, .TypeElement, javax.tools.FileObject, jdk.javadoc.internal.doclets.formats.html.markup.Head, .HtmlDocument, .HtmlStyles, jdk.javadoc.internal.doclets.toolkit.Messages, .Resources, jdk.javadoc.internal.doclets.toolkit.util.DocFile, .DocFileIOException, .DocPath, .DocPaths, .SimpleDocletException, .Utils, jdk.javadoc.internal.html.Content, .HtmlId, .HtmlTag, .HtmlTree, .Text

Converts Java Source Code to HTML.

Field Summary

Modifier and TypeField and Description
private final HtmlConfiguration
private final Messages
private static final String
NEW_LINE

New line to be added to the documentation.

private static final int
NUM_BLANK_LINES

The number of trailing blank lines at the end of the page.

private final HtmlOptions
private final DocPath
private DocPath
relativePath

Relative path from the documentation root to the file that is being generated.

private final Resources
private final Utils

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
addBlankLines(Content
the content to which the blank lines will be added.
pre
)

Add trailing blank lines at the end of the page.

private void
addLine(HtmlTree
the content to which the line will be added.
pre
,
String
the string to format.
line
,
int
the current number.
currentLineNo
)

Add a line from source to the HTML file that is generated.

private static void
addLineNo(Content
the content to which the line number will be added
pre
,
int
The line number
lineno
)

Add the line numbers for the source code.

public void
convertClass(TypeElement
the class to convert.
te
,
DocPath
the name of the directory to output to
outputdir
)

Convert the given Class to an HTML.

public void
convertModule(ModuleElement
the module to convert.
mdl
,
DocPath
the name of the directory to output to.
outputdir
)

Convert the documented packages contained in the given module to an HTML representation.

public void
convertPackage(PackageElement
the Package to convert.
pkg
,
DocPath
the name of the directory to output to.
outputdir
)

Convert the Classes in the given Package to an HTML file.

public static void
convertRoot(HtmlConfiguration
the configuration.
configuration
,
DocPath
the name of the directory to output to.
outputdir
)

Translate the TypeElements in the given DocletEnvironment to HTML representation.

pack-priv void
public static HtmlId

Returns:

the name of the anchor.
getAnchorName
(Utils
the utility class, used to get the line number of the element
utils
,
Element
the element to check.
e
)

Given an element, return an anchor name for it.

private static Content

Returns:

the header content for the HTML file
getHeader
()

Get the header.

private void
writeToFile(Content
the documentation content to be written to the file.
body
,
DocPath
the path for the file.
path
,
TypeElement te)

Write the output to the file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationback to summary
private final HtmlConfiguration configuration
messagesback to summary
private final Messages messages
NEW_LINEback to summary
private static final String NEW_LINE

New line to be added to the documentation.

NUM_BLANK_LINESback to summary
private static final int NUM_BLANK_LINES

The number of trailing blank lines at the end of the page. This is inserted so that anchors at the bottom of small pages can be reached.

optionsback to summary
private final HtmlOptions options
outputdirback to summary
private final DocPath outputdir
relativePathback to summary
private DocPath relativePath

Relative path from the documentation root to the file that is being generated.

resourcesback to summary
private final Resources resources
utilsback to summary
private final Utils utils

Constructor Detail

SourceToHTMLConverterback to summary
private SourceToHTMLConverter(HtmlConfiguration configuration, DocPath outputdir)

Method Detail

addBlankLinesback to summary
private static void addBlankLines(Content pre)

Add trailing blank lines at the end of the page.

Parameters
pre:Content

the content to which the blank lines will be added.

addLineback to summary
private void addLine(HtmlTree pre, String line, int currentLineNo)

Add a line from source to the HTML file that is generated.

Parameters
pre:HtmlTree

the content to which the line will be added.

line:String

the string to format.

currentLineNo:int

the current number.

addLineNoback to summary
private static void addLineNo(Content pre, int lineno)

Add the line numbers for the source code.

Parameters
pre:Content

the content to which the line number will be added

lineno:int

The line number

convertClassback to summary
public void convertClass(TypeElement te, DocPath outputdir) throws DocFileIOException, SimpleDocletException

Convert the given Class to an HTML.

Parameters
te:TypeElement

the class to convert.

outputdir:DocPath

the name of the directory to output to

Exceptions
DocFileIOException:
if there is a problem generating the output file
SimpleDocletException:
if there is a problem reading the source file
convertModuleback to summary
public void convertModule(ModuleElement mdl, DocPath outputdir) throws DocFileIOException, SimpleDocletException

Convert the documented packages contained in the given module to an HTML representation.

Parameters
mdl:ModuleElement

the module to convert.

outputdir:DocPath

the name of the directory to output to.

Exceptions
DocFileIOException:
if there is a problem generating an output file
SimpleDocletException:
if there is a problem reading a source file
convertPackageback to summary
public void convertPackage(PackageElement pkg, DocPath outputdir) throws DocFileIOException, SimpleDocletException

Convert the Classes in the given Package to an HTML file.

Parameters
pkg:PackageElement

the Package to convert.

outputdir:DocPath

the name of the directory to output to.

Exceptions
DocFileIOException:
if there is a problem generating an output file
SimpleDocletException:
if there is a problem reading a source file
convertRootback to summary
public static void convertRoot(HtmlConfiguration configuration, DocPath outputdir) throws DocFileIOException, SimpleDocletException

Translate the TypeElements in the given DocletEnvironment to HTML representation.

Parameters
configuration:HtmlConfiguration

the configuration.

outputdir:DocPath

the name of the directory to output to.

Exceptions
DocFileIOException:
if there is a problem generating an output file
SimpleDocletException:
if there is a problem reading a source file
generateback to summary
pack-priv void generate() throws DocFileIOException, SimpleDocletException
getAnchorNameback to summary
public static HtmlId getAnchorName(Utils utils, Element e)

Given an element, return an anchor name for it.

Parameters
utils:Utils

the utility class, used to get the line number of the element

e:Element

the element to check.

Returns:HtmlId

the name of the anchor.

getHeaderback to summary
private static Content getHeader()

Get the header.

Returns:Content

the header content for the HTML file

writeToFileback to summary
private void writeToFile(Content body, DocPath path, TypeElement te) throws DocFileIOException

Write the output to the file.

Parameters
body:Content

the documentation content to be written to the file.

path:DocPath

the path for the file.