public final class Navigator extends Object
Modifier and Type | Method and Description |
---|---|
static com.github.javaparser.ast.body.ClassOrInterfaceDeclaration |
demandClass(com.github.javaparser.ast.CompilationUnit cu,
String qualifiedName) |
static com.github.javaparser.ast.body.ClassOrInterfaceDeclaration |
demandClassOrInterface(com.github.javaparser.ast.CompilationUnit compilationUnit,
String qualifiedName) |
static com.github.javaparser.ast.body.ConstructorDeclaration |
demandConstructor(com.github.javaparser.ast.body.TypeDeclaration<?> td,
int index)
Returns the
(i+1) 'th constructor of the given type declaration, in textual order. |
static com.github.javaparser.ast.body.EnumDeclaration |
demandEnum(com.github.javaparser.ast.CompilationUnit cu,
String qualifiedName) |
static com.github.javaparser.ast.body.VariableDeclarator |
demandField(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration cd,
String name) |
static com.github.javaparser.ast.body.ClassOrInterfaceDeclaration |
demandInterface(com.github.javaparser.ast.CompilationUnit cu,
String qualifiedName) |
static com.github.javaparser.ast.body.MethodDeclaration |
demandMethod(com.github.javaparser.ast.body.TypeDeclaration<?> cd,
String name) |
static Optional<com.github.javaparser.ast.body.VariableDeclarator> |
demandVariableDeclaration(com.github.javaparser.ast.Node node,
String name) |
static <N extends com.github.javaparser.ast.Node> |
findAllNodesOfGivenClass(com.github.javaparser.ast.Node node,
Class<N> clazz)
Deprecated.
use Node.findAll instead
|
static <N extends com.github.javaparser.ast.Node> |
findAncestor(com.github.javaparser.ast.Node node,
Class<N> clazz)
Deprecated.
use Node.findAncestor instead
|
static Optional<com.github.javaparser.ast.expr.MethodCallExpr> |
findMethodCall(com.github.javaparser.ast.Node node,
String methodName) |
static Optional<com.github.javaparser.ast.expr.NameExpr> |
findNameExpression(com.github.javaparser.ast.Node node,
String name) |
static <N extends com.github.javaparser.ast.Node> |
findNodeOfGivenClass(com.github.javaparser.ast.Node node,
Class<N> clazz) |
static com.github.javaparser.ast.stmt.ReturnStmt |
findReturnStmt(com.github.javaparser.ast.body.MethodDeclaration method) |
static Optional<com.github.javaparser.ast.expr.SimpleName> |
findSimpleName(com.github.javaparser.ast.Node node,
String name) |
static com.github.javaparser.ast.stmt.SwitchStmt |
findSwitch(com.github.javaparser.ast.Node node) |
static Optional<com.github.javaparser.ast.body.TypeDeclaration<?>> |
findType(com.github.javaparser.ast.CompilationUnit cu,
String qualifiedName)
Looks among the type declared in the Compilation Unit for one having the specified name.
|
static Optional<com.github.javaparser.ast.body.TypeDeclaration<?>> |
findType(com.github.javaparser.ast.body.TypeDeclaration<?> td,
String qualifiedName)
Looks among the type declared in the TypeDeclaration for one having the specified name.
|
static com.github.javaparser.ast.Node |
getParentNode(com.github.javaparser.ast.Node node)
Deprecated.
use Node.getParentNode
|
static com.github.javaparser.ast.Node |
requireParentNode(com.github.javaparser.ast.Node node) |
@Deprecated public static com.github.javaparser.ast.Node getParentNode(com.github.javaparser.ast.Node node)
public static com.github.javaparser.ast.Node requireParentNode(com.github.javaparser.ast.Node node)
public static Optional<com.github.javaparser.ast.body.TypeDeclaration<?>> findType(com.github.javaparser.ast.CompilationUnit cu, String qualifiedName)
public static Optional<com.github.javaparser.ast.body.TypeDeclaration<?>> findType(com.github.javaparser.ast.body.TypeDeclaration<?> td, String qualifiedName)
public static com.github.javaparser.ast.body.ClassOrInterfaceDeclaration demandClass(com.github.javaparser.ast.CompilationUnit cu, String qualifiedName)
public static com.github.javaparser.ast.body.ClassOrInterfaceDeclaration demandInterface(com.github.javaparser.ast.CompilationUnit cu, String qualifiedName)
public static com.github.javaparser.ast.body.EnumDeclaration demandEnum(com.github.javaparser.ast.CompilationUnit cu, String qualifiedName)
public static com.github.javaparser.ast.body.MethodDeclaration demandMethod(com.github.javaparser.ast.body.TypeDeclaration<?> cd, String name)
public static com.github.javaparser.ast.body.ConstructorDeclaration demandConstructor(com.github.javaparser.ast.body.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.null
otherwise.public static com.github.javaparser.ast.body.VariableDeclarator demandField(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration cd, String name)
public static Optional<com.github.javaparser.ast.expr.NameExpr> findNameExpression(com.github.javaparser.ast.Node node, String name)
public static Optional<com.github.javaparser.ast.expr.SimpleName> findSimpleName(com.github.javaparser.ast.Node node, String name)
public static Optional<com.github.javaparser.ast.expr.MethodCallExpr> findMethodCall(com.github.javaparser.ast.Node node, String methodName)
public static Optional<com.github.javaparser.ast.body.VariableDeclarator> demandVariableDeclaration(com.github.javaparser.ast.Node node, String name)
public static com.github.javaparser.ast.body.ClassOrInterfaceDeclaration demandClassOrInterface(com.github.javaparser.ast.CompilationUnit compilationUnit, String qualifiedName)
public static com.github.javaparser.ast.stmt.SwitchStmt findSwitch(com.github.javaparser.ast.Node node)
public static <N extends com.github.javaparser.ast.Node> N findNodeOfGivenClass(com.github.javaparser.ast.Node node, Class<N> clazz)
@Deprecated public static <N extends com.github.javaparser.ast.Node> List<N> findAllNodesOfGivenClass(com.github.javaparser.ast.Node node, Class<N> clazz)
public static com.github.javaparser.ast.stmt.ReturnStmt findReturnStmt(com.github.javaparser.ast.body.MethodDeclaration method)
@Deprecated public static <N extends com.github.javaparser.ast.Node> Optional<N> findAncestor(com.github.javaparser.ast.Node node, Class<N> clazz)
Copyright © 2007–2018. All rights reserved.