|
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.TreeUtilities
public final class TreeUtilities
| Method Summary | |
|---|---|
TypeMirror |
attributeTree(Tree tree,
Scope scope)
Attribute the given tree in the given context. |
Scope |
attributeTreeTo(Tree tree,
Scope scope,
Tree to)
Attribute the given tree until the given to tree is reached. |
CharSequence |
decodeIdentifier(CharSequence text)
Decode escapes defined in: http://wikis.sun.com/display/mlvm/ProjectCoinProposal, 3.1-3.9. |
CharSequence |
encodeIdentifier(CharSequence ident)
Encode identifier using escapes defined in: http://wikis.sun.com/display/mlvm/ProjectCoinProposal, 3.1-3.9. |
int[] |
findNameSpan(ClassTree clazz)
Find span of the ClassTree.getSimpleName() identifier in the source. |
int[] |
findNameSpan(MemberSelectTree mst)
Find span of the MemberSelectTree.getIdentifier() identifier in the source. |
int[] |
findNameSpan(MethodTree method)
Find span of the MethodTree.getName() identifier in the source. |
int[] |
findNameSpan(VariableTree var)
Find span of the VariableTree.getName() identifier in the source. |
StatementTree |
getBreakContinueTarget(TreePath breakOrContinue)
Find the target of break or continue. |
List<Comment> |
getComments(Tree tree,
boolean preceding)
Returns list of comments attached to a given tree. |
Set<TypeMirror> |
getUncaughtExceptions(TreePath path)
Returns uncaught exceptions inside the given tree path. |
boolean |
isAccessible(Scope scope,
Element member,
TypeMirror type)
Checks whether the given element is accessible as a member of the given type in a given scope. |
boolean |
isAnnotation(ClassTree tree)
Checks whether the given tree represents an annotation. |
boolean |
isClass(ClassTree tree)
Checks whether the given tree represents a class. |
boolean |
isEnum(ClassTree tree)
Checks whether the given tree represents an enum. |
boolean |
isEnumConstant(VariableTree tree)
Checks wheteher given variable tree represents an enum constant. |
boolean |
isInterface(ClassTree tree)
Checks whether the given tree represents an interface. |
boolean |
isStaticContext(Scope scope)
Checks whether the given scope is in "static" context. |
boolean |
isSynthetic(TreePath path)
Returns whether or not the given tree is synthetic - generated by the parser. |
ExpressionTree |
parseExpression(String expr,
SourcePositions[] sourcePositions)
Parses given expression. |
StatementTree |
parseStatement(String stmt,
SourcePositions[] sourcePositions)
Parses given statement. |
BlockTree |
parseStaticBlock(String block,
SourcePositions[] sourcePositions)
Parses given static block. |
TypeMirror |
parseType(String expr,
TypeElement scope)
Parses given type in given context. |
ExpressionTree |
parseVariableInitializer(String init,
SourcePositions[] sourcePositions)
Parses given variable initializer. |
TreePath |
pathFor(int pos)
|
TreePath |
pathFor(TreePath path,
int pos)
|
TreePath |
pathFor(TreePath path,
int pos,
SourcePositions sourcePositions)
|
TypeMirror |
reattributeTree(Tree tree,
Scope scope)
|
Scope |
reattributeTreeTo(Tree tree,
Scope scope,
Tree to)
|
Scope |
scopeFor(int pos)
Computes Scope for the given position. |
TokenSequence<org.netbeans.api.java.lexer.JavaTokenId> |
tokensFor(Tree tree)
Returns tokens for a given tree. |
TokenSequence<org.netbeans.api.java.lexer.JavaTokenId> |
tokensFor(Tree tree,
SourcePositions sourcePositions)
Returns tokens for a given tree. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public boolean isClass(ClassTree tree)
public boolean isInterface(ClassTree tree)
public boolean isEnum(ClassTree tree)
public boolean isEnumConstant(VariableTree tree)
public boolean isAnnotation(ClassTree tree)
public boolean isSynthetic(TreePath path)
throws NullPointerException
NullPointerException - if the given tree is null
public List<Comment> getComments(Tree tree,
boolean preceding)
tree - for which comments should be returnedpreceding - true if preceding comments should be returned, false if trailing comments should be returned.
public TreePath pathFor(int pos)
public TreePath pathFor(TreePath path,
int pos)
public TreePath pathFor(TreePath path,
int pos,
SourcePositions sourcePositions)
public TypeMirror parseType(String expr,
TypeElement scope)
expr - type specificationscope - in which simple names should be resolved
TypeMirror or null if the given specification cannot be parsed
public StatementTree parseStatement(String stmt,
SourcePositions[] sourcePositions)
stmt - statement codesourcePositions - return value - new SourcePositions for the new tree
StatementTree or null?
public ExpressionTree parseExpression(String expr,
SourcePositions[] sourcePositions)
expr - expression codesourcePositions - return value - new SourcePositions for the new tree
ExpressionTree or null?
public ExpressionTree parseVariableInitializer(String init,
SourcePositions[] sourcePositions)
init - initializer codesourcePositions - return value - new SourcePositions for the new tree
ExpressionTree or null?
public BlockTree parseStaticBlock(String block,
SourcePositions[] sourcePositions)
block - block codesourcePositions - return value - new SourcePositions for the new tree
BlockTree or null?public Scope scopeFor(int pos)
Scope for the given position.
public TypeMirror attributeTree(Tree tree,
Scope scope)
public Scope attributeTreeTo(Tree tree,
Scope scope,
Tree to)
to tree is reached.
Returns scope valid at point when to is reached.
public TypeMirror reattributeTree(Tree tree,
Scope scope)
public Scope reattributeTreeTo(Tree tree,
Scope scope,
Tree to)
public TokenSequence<org.netbeans.api.java.lexer.JavaTokenId> tokensFor(Tree tree)
public TokenSequence<org.netbeans.api.java.lexer.JavaTokenId> tokensFor(Tree tree,
SourcePositions sourcePositions)
SourcePositions.
public boolean isAccessible(Scope scope,
Element member,
TypeMirror type)
scope - the scope to be checkedmember - the member to be checkedtype - the type for which to check if the member is accessible
member is accessible in typepublic boolean isStaticContext(Scope scope)
public Set<TypeMirror> getUncaughtExceptions(TreePath path)
public int[] findNameSpan(ClassTree clazz)
ClassTree.getSimpleName() identifier in the source.
Returns starting and ending offset of the name in the source code that was parsed
(ie. CompilationInfo.getText(), which may differ from the positions in the source
document if it has been already altered.
clazz - class which name should be searched for
public int[] findNameSpan(MethodTree method)
MethodTree.getName() identifier in the source.
Returns starting and ending offset of the name in the source code that was parsed
(ie. CompilationInfo.getText(), which may differ from the positions in the source
document if it has been already altered.
method - method which name should be searched for
public int[] findNameSpan(VariableTree var)
VariableTree.getName() identifier in the source.
Returns starting and ending offset of the name in the source code that was parsed
(ie. CompilationInfo.getText(), which may differ from the positions in the source
document if it has been already altered.
var - variable which name should be searched for
public int[] findNameSpan(MemberSelectTree mst)
MemberSelectTree.getIdentifier() identifier in the source.
Returns starting and ending offset of the name in the source code that was parsed
(ie. CompilationInfo.getText(), which may differ from the positions in the source
document if it has been already altered.
mst - member select which identifier should be searched for
public StatementTree getBreakContinueTarget(TreePath breakOrContinue)
throws IllegalArgumentException
break or continue. The given
CompilationInfo has to be at least in the JavaSource.Phase.RESOLVED phase.
breakOrContinue - TreePath to the tree that should be inspected.
The breakOrContinue.getLeaf().getKind()
has to be either Tree.Kind.BREAK or Tree.Kind.CONTINUE, or
an IllegalArgumentException is thrown
IllegalArgumentException - if the given tree is not a break or continue tree or if the given CompilationInfo
is not in the JavaSource.Phase.RESOLVED phase.
@NonNull
public CharSequence decodeIdentifier(@NonNull
CharSequence text)
text - to decode
http://wikis.sun.com/display/mlvm/ProjectCoinProposal
@NonNull
public CharSequence encodeIdentifier(@NonNull
CharSequence ident)
text - to encode
http://wikis.sun.com/display/mlvm/ProjectCoinProposal
|
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 | |||||||||