public abstract class DocTrees extends Trees
Constructor | Description |
---|---|
DocTrees() |
Constructor for subclasses to call. |
Modifier and Type | Method | Description |
---|---|---|
abstract BreakIterator |
getBreakIterator() |
Returns the break iterator used to compute the first sentence of documentation comments. |
abstract String |
getCharacters |
Returns a string containing the characters for the entity in a given entity tree, or null if the tree does not represent a valid series of characters. |
abstract DocCommentTree |
getDocCommentTree |
Returns the doc comment tree, if any, for the Tree node identified by a given TreePath. |
abstract DocCommentTree |
getDocCommentTree |
Returns the doc comment tree of the given element. |
abstract DocCommentTree |
getDocCommentTree |
Returns the doc comment tree of the given file whose path is specified relative to the given element. |
abstract DocCommentTree |
getDocCommentTree |
Returns the doc comment tree of the given file. |
abstract DocTreeFactory |
getDocTreeFactory() |
Returns a utility object for creating DocTree objects. |
abstract DocTreePath |
getDocTreePath |
Returns a doc tree path containing the doc comment tree of the given file. |
abstract Element |
getElement |
Returns the language model element referred to by the leaf node of the given DocTreePath , or null if unknown. |
abstract List |
getFirstSentence |
Returns the list of DocTree representing the first sentence of a comment. |
abstract DocSourcePositions |
getSourcePositions() |
Returns a utility object for accessing the source positions of documentation tree nodes. |
abstract TypeMirror |
getType |
Returns the language model type referred to by the leaf node of the given DocTreePath , or null if unknown. |
static DocTrees |
instance |
Returns a DocTrees object for a given ProcessingEnvironment. |
static DocTrees |
instance |
Returns a DocTrees object for a given CompilationTask. |
abstract void |
printMessage |
Prints a message of the specified kind at the location of the tree within the provided compilation unit. |
abstract void |
setBreakIterator |
Sets the break iterator to compute the first sentence of documentation comments. |
getDocComment, getElement, getLub, getOriginalType, getPath, getPath, getPath, getPath, getScope, getTree, getTree, getTree, getTree, getTree, getTypeMirror, isAccessible, isAccessible, printMessage
public DocTrees()
public static DocTrees instance(JavaCompiler.CompilationTask task)
task
- the compilation task for which to get the Trees objectIllegalArgumentException
- if the task does not support the Trees API.public static DocTrees instance(ProcessingEnvironment env)
env
- the processing environment for which to get the Trees objectIllegalArgumentException
- if the env does not support the Trees API.public abstract BreakIterator getBreakIterator()
null
if none has been specified.public abstract DocCommentTree getDocCommentTree(TreePath path)
null
if no doc comment was found.DocCommentTree
instance for repeated invocations with the same argument.path
- the path for the tree nodepublic abstract DocCommentTree getDocCommentTree(Element e)
null
if no doc comment was found.DocCommentTree
instance for repeated invocations with the same argument.e
- an element whose documentation is requiredpublic abstract DocCommentTree getDocCommentTree(FileObject fileObject)
null
if no doc comment was found. Future releases may support additional file types.DocCommentTree
instance for each invocation.fileObject
- the content containerpublic abstract DocCommentTree getDocCommentTree(Element e, String relativePath) throws IOException
null
if no doc comment was found. Future releases may support additional file types.DocCommentTree
instance for each invocation.e
- an element whose path is used as a referencerelativePath
- the relative path from the ElementIOException
- if an exception occurspublic abstract DocTreePath getDocTreePath(FileObject fileObject, PackageElement packageElement)
<body>
tag, and any enclosing tags are ignored. Any references to source code elements contained in @see
and {@link}
tags in the doc comment tree will be evaluated in the context of the given package element. Returns null
if no doc comment was found.fileObject
- a file object encapsulating the HTML contentpackageElement
- a package element to associate with the given file object representing a legacy package.html, null otherwiseIllegalArgumentException
- if the fileObject is not an HTML filepublic abstract Element getElement(DocTreePath path)
DocTreePath
, or null
if unknown.path
- the path for the tree nodepublic abstract TypeMirror getType(DocTreePath path)
DocTreePath
, or null
if unknown. This method usually returns the same value as getElement(path).asType()
for a path
argument for which getElement(DocTreePath)
returns a non-null value, but may return a type that includes additional information, such as a parameterized generic type instead of a raw type.path
- the path for the tree nodepublic abstract List<DocTree> getFirstSentence(List<? extends DocTree> list)
DocTree
representing the first sentence of a comment.list
- the DocTree list to interrogatepublic abstract DocSourcePositions getSourcePositions()
getSourcePositions
in class Trees
public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, DocTree t, DocCommentTree c, CompilationUnitTree root)
kind
- the kind of messagemsg
- the message, or an empty string if nonet
- the tree to use as a position hintc
- the doc comment tree to use as a position hintroot
- the compilation unit that contains treepublic abstract void setBreakIterator(BreakIterator breakIterator)
breakIterator
- a break iterator or null
to specify the default sentence breakerpublic abstract DocTreeFactory getDocTreeFactory()
DocTree
objects.DocTree
objectspublic abstract String getCharacters(EntityTree tree)
null
if the tree does not represent a valid series of characters. The interpretation of entities is based on section 8.1.4. Character references in the HTML 5.2 specification.
tree
- the tree containing the entity
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/util/DocTrees.html