public final class DocTreePathHandle extends Object
TreePath
which can be kept and later resolved
by another javac. The Javac Element
s are valid only in the single
CompilationTask
or single run of the
CancellableTask
. If the client needs to
keep a reference to the TreePath
and use it in the other
CancellableTask he has to serialize it into the TreePathHandle
.
Typical usage of TreePathHandle enclElIsCorrespondingEl:
final TreePathHandle[] tpHandle = new TreePathHandle[1]; javaSource.runCompileControlTask(new CancellableTask() { public void run(CompilationController compilationController) { parameter.toPhase(Phase.RESOLVED); CompilationUnitTree cu = compilationController.getTree (); TreePath treePath = getInterestingTreePath (cu); treePathHandle[0] = TreePathHandle.create (element, compilationController); } },priority); otherJavaSource.runCompileControlTask(new CancellableTask () { public void run(CompilationController compilationController) { parameter.toPhase(Phase.RESOLVED); TreePath treePath = treePathHanlde[0].resolve (compilationController); .... } },priority);
Modifier and Type | Method and Description |
---|---|
static DocTreePathHandle |
create(DocTreePath docTreePath,
CompilationInfo javac)
Factory method for creating
DocTreePathHandle . |
boolean |
equals(Object obj) |
com.sun.source.doctree.DocTree.Kind |
getKind()
Returns the
DocTree.Kind of this DocTreePathHandle, it returns the kind
of the DocTree from which the handle was created. |
TreePathHandle |
getTreePathHandle()
returns
TreePathHandle corresponding to this DocTreePathHandle |
int |
hashCode() |
DocTreePath |
resolve(CompilationInfo compilationInfo)
Resolves an
DocTreePath from the DocTreePathHandle . |
String |
toString() |
public DocTreePath resolve(CompilationInfo compilationInfo) throws IllegalArgumentException
DocTreePath
from the DocTreePathHandle
.compilationInfo
- representing the
CompilationTask
DocTreePath
or null if the doctree does
not exist on the classpath/sourcepath of
CompilationTask
.IllegalArgumentException
- when this DocTreePathHandle
is not
created for a source represented by the compilationInfo.public TreePathHandle getTreePathHandle()
TreePathHandle
corresponding to this DocTreePathHandle
TreePathHandle
public com.sun.source.doctree.DocTree.Kind getKind()
DocTree.Kind
of this DocTreePathHandle, it returns the kind
of the DocTree
from which the handle was created.Tree.Kind
public static DocTreePathHandle create(DocTreePath docTreePath, CompilationInfo javac) throws IllegalArgumentException
DocTreePathHandle
.docTreePath
- for which the DocTreePathHandle
should be created.javac
- DocTreePathHandle
IllegalArgumentException
- if arguments are not supported