Navigator

This class can be used to easily retrieve nodes from a JavaParser AST. Note that methods with the prefix `demand` indicate that if the search value is not found, an exception will be thrown.

Author

Federico Tomassetti

Functions

Link copied to clipboard
Link copied to clipboard
open fun demandClassOrInterface(compilationUnit: CompilationUnit, qualifiedName: String): ClassOrInterfaceDeclaration
Link copied to clipboard
Returns the (i+1)'th constructor of the given type declaration, in textual order.
Link copied to clipboard
open fun demandEnum(cu: CompilationUnit, qualifiedName: String): EnumDeclaration
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun <N : Node?> demandNodeOfGivenClass(node: Node, clazz: Class<N>): N
Link copied to clipboard
open fun demandParentNode(node: Node): Node

open fun demandParentNode(node: Node, isAcceptedParentNode: Predicate<Node>): Node
Traverses the parent chain starting at node and returns the first Node that returns make isAcceptedParentNode evaluate to true.
Link copied to clipboard
Link copied to clipboard
open fun demandSwitch(node: Node): SwitchStmt
Link copied to clipboard
open fun findMethodCall(node: Node, methodName: String): Optional<MethodCallExpr>
Link copied to clipboard
Link copied to clipboard
open fun <N : Node?> findNodeOfGivenClass(node: Node, clazz: Class<N>): N
Link copied to clipboard
Link copied to clipboard
open fun findSimpleName(node: Node, name: String): Optional<SimpleName>
Link copied to clipboard
open fun findSwitch(node: Node): SwitchStmt
Link copied to clipboard
open fun findType(cu: CompilationUnit, qualifiedName: String): Optional<TypeDeclaration<out Any>>
Looks among the type declared in the Compilation Unit for one having the specified name.
open fun findType(td: TypeDeclaration<out Any>, qualifiedName: String): Optional<TypeDeclaration<out Any>>
Looks among the type declared in the TypeDeclaration for one having the specified name.
Link copied to clipboard
open fun requireParentNode(node: Node): Node