public final class Navigator extends Object
Modifier and Type | Method and Description |
---|---|
static ClassOrInterfaceDeclaration |
demandClass(CompilationUnit cu,
String qualifiedName) |
static ClassOrInterfaceDeclaration |
demandClassOrInterface(CompilationUnit compilationUnit,
String qualifiedName) |
static ConstructorDeclaration |
demandConstructor(TypeDeclaration<?> td,
int index)
Returns the
(i+1) 'th constructor of the given type declaration, in textual order. |
static EnumDeclaration |
demandEnum(CompilationUnit cu,
String qualifiedName) |
static VariableDeclarator |
demandField(ClassOrInterfaceDeclaration cd,
String name) |
static ClassOrInterfaceDeclaration |
demandInterface(CompilationUnit cu,
String qualifiedName) |
static MethodDeclaration |
demandMethod(TypeDeclaration<?> cd,
String name) |
static <N extends Node> |
demandNodeOfGivenClass(Node node,
Class<N> clazz) |
static Node |
demandParentNode(Node node) |
static Node |
demandParentNode(Node node,
Predicate<Node> isAcceptedParentNode)
Traverses the parent chain starting at
node and returns the
first Node that returns make isAcceptedParentNode evaluate to
true . |
static ReturnStmt |
demandReturnStmt(MethodDeclaration method) |
static SwitchStmt |
demandSwitch(Node node) |
static Optional<VariableDeclarator> |
demandVariableDeclaration(Node node,
String name) |
static Optional<MethodCallExpr> |
findMethodCall(Node node,
String methodName) |
static Optional<NameExpr> |
findNameExpression(Node node,
String name) |
static <N extends Node> |
findNodeOfGivenClass(Node node,
Class<N> clazz)
Deprecated.
|
static ReturnStmt |
findReturnStmt(MethodDeclaration method)
Deprecated.
|
static Optional<SimpleName> |
findSimpleName(Node node,
String name) |
static SwitchStmt |
findSwitch(Node node)
Deprecated.
|
static Optional<TypeDeclaration<?>> |
findType(CompilationUnit cu,
String qualifiedName)
Looks among the type declared in the Compilation Unit for one having the specified name.
|
static Optional<TypeDeclaration<?>> |
findType(TypeDeclaration<?> td,
String qualifiedName)
Looks among the type declared in the TypeDeclaration for one having the specified name.
|
static Node |
requireParentNode(Node node)
Deprecated.
|
public static ClassOrInterfaceDeclaration demandClass(CompilationUnit cu, String qualifiedName)
public static ClassOrInterfaceDeclaration demandClassOrInterface(CompilationUnit compilationUnit, String qualifiedName)
public static ConstructorDeclaration demandConstructor(TypeDeclaration<?> td, int index)
(i+1)
'th constructor of the given type declaration, in textual order. The constructor that
appears first has the index 0, the second one the index 1, and so on.td
- The type declaration to search in. Note that only classes and enums have constructors.index
- The index of the desired constructor.public static EnumDeclaration demandEnum(CompilationUnit cu, String qualifiedName)
public static VariableDeclarator demandField(ClassOrInterfaceDeclaration cd, String name)
public static ClassOrInterfaceDeclaration demandInterface(CompilationUnit cu, String qualifiedName)
public static MethodDeclaration demandMethod(TypeDeclaration<?> cd, String name)
public static <N extends Node> N demandNodeOfGivenClass(Node node, Class<N> clazz)
public static Node demandParentNode(Node node, Predicate<Node> isAcceptedParentNode)
node
and returns the
first Node that returns make isAcceptedParentNode
evaluate to
true
.public static ReturnStmt demandReturnStmt(MethodDeclaration method)
public static SwitchStmt demandSwitch(Node node)
public static Optional<VariableDeclarator> demandVariableDeclaration(Node node, String name)
public static Optional<MethodCallExpr> findMethodCall(Node node, String methodName)
@Deprecated public static <N extends Node> N findNodeOfGivenClass(Node node, Class<N> clazz)
demandNodeOfGivenClass(Node, Class)
@Deprecated public static ReturnStmt findReturnStmt(MethodDeclaration method)
demandReturnStmt(MethodDeclaration)
public static Optional<SimpleName> findSimpleName(Node node, String name)
@Deprecated public static SwitchStmt findSwitch(Node node)
demandSwitch(Node)
public static Optional<TypeDeclaration<?>> findType(CompilationUnit cu, String qualifiedName)
public static Optional<TypeDeclaration<?>> findType(TypeDeclaration<?> td, String qualifiedName)
@Deprecated public static Node requireParentNode(Node node)
demandParentNode(Node)
Copyright © 2007–2024. All rights reserved.