|
org.netbeans.modules.java.source 0.60.2 10 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.api.java.source.TypeMirrorHandle<T>
public final class TypeMirrorHandle<T extends TypeMirror>
Represents a handle for TypeMirror which can be kept and later resolved
by another javac. The Javac TypeMirrors are valid only in the single
CompilationTask or single run of the
CancellableTask. If the client needs to
keep a reference to the TypeMirror and use it in the other CancellableTask
he has to serialize it into the TypeMirrorHandle.
Typical usage of TypeMirrorHandle is:
final TypeMirrorHandle[] typeMirrorHandle = new TypeMirrorHandle[1]; javaSource.runCompileControlTask(new CancellableTask() { public void run(CompilationController compilationController) { parameter.toPhase(Phase.RESOLVED); CompilationUnitTree cu = compilationController.getTree (); TypeMirror type = getInterestingType(cu); typeMirrorHandle[0] = TypeMirrorHandle.create (type); } },priority); otherJavaSource.runCompileControlTask(new CancellableTask () { public void run(CompilationController compilationController) { parameter.toPhase(Phase.RESOLVED); TypeMirror type = typeMirrorHandle[0].resolve (compilationController); .... } },priority);
TypeMirror kinds are supported by handle.
The unsupported kinds are: TypeKind.EXECUTABLE, TypeKind.OTHER,
and TypeKind.PACKAGE.
| Method Summary | ||
|---|---|---|
static
|
create(T tm)
Factory method for creating TypeMirrorHandle. |
|
TypeKind |
getKind()
Returns the TypeKind of this handle,
it is the kind of the TypeMirror from which the handle
was created. |
|
T |
resolve(CompilationInfo info)
Resolves an TypeMirror from the TypeMirrorHandle. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
@NonNull
public static <T extends TypeMirror> TypeMirrorHandle<T> create(@NonNull
T tm)
TypeMirrorHandle.
{@link - TypeMirror} for which the TypeMirrorHandle should be created.
Not all the TypeMirror kinds are currently supported.
The unsupported kinds are: TypeKind.EXECUTABLE, TypeKind.OTHER,
and TypeKind.PACKAGE.
TypeMirrorHandle
IllegalArgumentException - if the TypeMirror is of an unsupported
TypeKind.
public T resolve(@NonNull
CompilationInfo info)
TypeMirror from the TypeMirrorHandle.
{@link - CompilationInfo} representing the CompilationTask
in which the TypeMirror should be resolved.
TypeMirror or null if the type cannot be
resolved in this CompilationTask.@NonNull public TypeKind getKind()
TypeKind of this handle,
it is the kind of the TypeMirror from which the handle
was created.
TypeKind
|
org.netbeans.modules.java.source 0.60.2 10 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||