|
org.netbeans.modules.java.source 0.13.0 1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.api.java.source.TreePathHandle
public final class TreePathHandle
Represents a handle for 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);
Method Summary | |
---|---|
static TreePathHandle |
create(Element element,
CompilationInfo info)
Factory method for creating TreePathHandle . |
static TreePathHandle |
create(TreePath treePath,
CompilationInfo info)
Factory method for creating TreePathHandle . |
FileObject |
getFileObject()
getter for FileObject from give TreePathHandle |
Tree.Kind |
getKind()
Returns the Tree.Kind of this TreePathHandle,
it returns the kind of the Tree from which the handle
was created. |
TreePath |
resolve(CompilationInfo compilationInfo)
Resolves an TreePath from the TreePathHandle . |
Element |
resolveElement(CompilationInfo info)
Resolves an Element from the TreePathHandle . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public FileObject getFileObject()
public TreePath resolve(CompilationInfo compilationInfo) throws IllegalArgumentException
TreePath
from the TreePathHandle
.
compilationInfo
- representing the CompilationTask
Element
or null if the elment does not exist on
the classpath/sourcepath of CompilationTask
.
{@link
- IllegalArgumentException} when this TreePathHandle
is not created for a source
represented by the compilationInfo.
IllegalArgumentException
public Element resolveElement(CompilationInfo info)
Element
from the TreePathHandle
.
compilationInfo
- representing the CompilationTask
Element
or null if the elment does not exist on
the classpath/sourcepath of CompilationTask
.public Tree.Kind getKind()
Tree.Kind
of this TreePathHandle,
it returns the kind of the Tree
from which the handle
was created.
Tree.Kind
public static TreePathHandle create(TreePath treePath, CompilationInfo info) throws IllegalArgumentException
TreePathHandle
.
treePath
- for which the TrePathHandle
should be created.info
-
TreePathHandle
IllegalArgumentException
- if arguments are not supportedpublic static TreePathHandle create(Element element, CompilationInfo info) throws IllegalArgumentException
TreePathHandle
.
element
- for which the TrePathHandle
should be created.info
-
TreePathHandle
IllegalArgumentException
- if arguments are not supported
|
org.netbeans.modules.java.source 0.13.0 1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |