APIdia Launch Partner
Top Description Inners Methods
javax.tools

public Interface DocumentationTool

extends Tool, OptionChecker
Imports
java.io.Writer, java.nio.charset.Charset, java.util.Locale, java.util.concurrent.Callable

Interface to invoke Java programming language documentation tools from programs.
Since
1.8

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
DocumentationTool.DocumentationTask

Interface representing a future for a documentation task.

public static enum

Method Summary

Modifier and TypeMethod and Description
public StandardJavaFileManager

Returns:

the standard file manager
getStandardFileManager
(DiagnosticListener<? super JavaFileObject>
a diagnostic listener for non-fatal diagnostics; if null use the compiler's default method for reporting diagnostics
diagnosticListener
,
Locale
the locale to apply when formatting diagnostics; null means the default locale.
locale
,
Charset
the character set used for decoding bytes; if null use the platform default
charset
)

Returns a new instance of the standard file manager implementation for this tool.

public DocumentationTool.DocumentationTask

Returns:

an object representing the compilation
getTask
(Writer
a Writer for additional output from the tool; use System.err if null
out
,
JavaFileManager
a file manager; if null use the tool's standard file manager
fileManager
,
DiagnosticListener<? super JavaFileObject>
a diagnostic listener; if null use the tool's default method for reporting diagnostics
diagnosticListener
,
Class<?>
a class providing the necessary methods required of a doclet; a value of null means to use the standard doclet.
docletClass
,
Iterable<String>
documentation tool options and doclet options, null means no options
options
,
Iterable<? extends JavaFileObject>
the compilation units to compile, null means no compilation units
compilationUnits
)

Creates a future for a documentation task with the given components and arguments.

Inherited from javax.tools.OptionChecker:
isSupportedOption
Inherited from javax.tools.Tool:
getSourceVersionsnamerun

Method Detail

getStandardFileManagerback to summary
public StandardJavaFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset)

Returns a new instance of the standard file manager implementation for this tool. The file manager will use the given diagnostic listener for producing any non-fatal diagnostics. Fatal errors will be signaled with the appropriate exceptions.

The standard file manager will be automatically reopened if it is accessed after calls to flush or close. The standard file manager must be usable with other tools.

Parameters
diagnosticListener:DiagnosticListener<? super JavaFileObject>

a diagnostic listener for non-fatal diagnostics; if null use the compiler's default method for reporting diagnostics

locale:Locale

the locale to apply when formatting diagnostics; null means the default locale.

charset:Charset

the character set used for decoding bytes; if null use the platform default

Returns:StandardJavaFileManager

the standard file manager

getTaskback to summary
public DocumentationTool.DocumentationTask getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Class<?> docletClass, Iterable<String> options, Iterable<? extends JavaFileObject> compilationUnits)

Creates a future for a documentation task with the given components and arguments. The task might not have completed as described in the DocumentationTask interface.

If a file manager is provided, it must be able to handle all locations defined in DocumentationTool.Location, as well as StandardLocation#SOURCE_PATH, StandardLocation#CLASS_PATH, and StandardLocation#PLATFORM_CLASS_PATH.

Parameters
out:Writer

a Writer for additional output from the tool; use System.err if null

fileManager:JavaFileManager

a file manager; if null use the tool's standard file manager

diagnosticListener:DiagnosticListener<? super JavaFileObject>

a diagnostic listener; if null use the tool's default method for reporting diagnostics

docletClass:Class<?>

a class providing the necessary methods required of a doclet; a value of null means to use the standard doclet.

options:Iterable<String>

documentation tool options and doclet options, null means no options

compilationUnits:Iterable<? extends JavaFileObject>

the compilation units to compile, null means no compilation units

Returns:DocumentationTool.DocumentationTask

an object representing the compilation

Exceptions
RuntimeException:
if an unrecoverable error occurred in a user supplied component. The cause will be the error in user code.
IllegalArgumentException:
if any of the given compilation units are of other kind than source
javax.tools back to summary

public Interface DocumentationTool.DocumentationTask

extends Callable<Boolean>

Interface representing a future for a documentation task. The task has not yet started. To start the task, call the call method.

Before calling the call method, additional aspects of the task can be configured, for example, by calling the setLocale method.

Method Summary

Modifier and TypeMethod and Description
public void
addModules(Iterable<String>
the names of the root modules
moduleNames
)

Adds root modules to be taken into account during module resolution.

public Boolean

Returns:

true if and only all the files were processed without errors; false otherwise
call
()

Redeclares java.util.concurrent.Callable.call.

Performs this documentation task.

public void
setLocale(Locale
the locale to apply; null means apply no locale
locale
)

Sets the locale to be applied when formatting diagnostics and other localized data.

Method Detail

addModulesback to summary
public void addModules(Iterable<String> moduleNames)

Adds root modules to be taken into account during module resolution. Invalid module names may cause either IllegalArgumentException to be thrown, or diagnostics to be reported when the task is started.

Parameters
moduleNames:Iterable<String>

the names of the root modules

Exceptions
IllegalArgumentException:
may be thrown for some invalid module names
IllegalStateException:
if the task has started
Since
9
callback to summary
public Boolean call()

Redeclares java.util.concurrent.Callable.call.

Performs this documentation task. The task may only be performed once. Subsequent calls to this method throw IllegalStateException.

Returns:Boolean

true if and only all the files were processed without errors; false otherwise

Annotations
@Override
Exceptions
RuntimeException:
if an unrecoverable error occurred in a user-supplied component. The cause will be the error in user code.
IllegalStateException:
if called more than once
setLocaleback to summary
public void setLocale(Locale locale)

Sets the locale to be applied when formatting diagnostics and other localized data.

Parameters
locale:Locale

the locale to apply; null means apply no locale

Exceptions
IllegalStateException:
if the task has started
javax.tools back to summary

public final Enum DocumentationTool.Location

extends Enum<DocumentationTool.Location>
implements Location
Class Inheritance
All Implemented Interfaces
javax.tools.JavaFileManager.Location

Locations specific to DocumentationTool.
See Also
StandardLocation

Field Summary

Modifier and TypeField and Description
public static final DocumentationTool.Location
DOCLET_PATH

Location to search for doclets.

public static final DocumentationTool.Location
DOCUMENTATION_OUTPUT

Location of new documentation files.

public static final DocumentationTool.Location
SNIPPET_PATH

Location to search for snippets.

public static final DocumentationTool.Location
TAGLET_PATH

Location to search for taglets.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
getName()

Implements javax.tools.JavaFileManager.Location.getName.

Returns the name of this location.

public boolean
isOutputLocation()

Implements javax.tools.JavaFileManager.Location.isOutputLocation.

Determines if this is an output location.

public static DocumentationTool.Location
public static DocumentationTool.Location[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DOCLET_PATHback to summary
public static final DocumentationTool.Location DOCLET_PATH

Location to search for doclets.

DOCUMENTATION_OUTPUTback to summary
public static final DocumentationTool.Location DOCUMENTATION_OUTPUT

Location of new documentation files.

SNIPPET_PATHback to summary
public static final DocumentationTool.Location SNIPPET_PATH

Location to search for snippets.

Since
18
TAGLET_PATHback to summary
public static final DocumentationTool.Location TAGLET_PATH

Location to search for taglets.

Constructor Detail

Locationback to summary
private Location()

Method Detail

getNameback to summary
public String getName()

Implements javax.tools.JavaFileManager.Location.getName.

Doc from javax.tools.JavaFileManager.Location.getName.

Returns the name of this location.

Annotations
@Override
isOutputLocationback to summary
public boolean isOutputLocation()

Implements javax.tools.JavaFileManager.Location.isOutputLocation.

Doc from javax.tools.JavaFileManager.Location.isOutputLocation.

Determines if this is an output location. An output location is a location that is conventionally used for output.

Annotations
@Override
valueOfback to summary
public static DocumentationTool.Location valueOf(String name)
valuesback to summary
public static DocumentationTool.Location[] values()