Package com.github.javaparser
Interface HasParentNode<T>
-
- All Superinterfaces:
Observable
- All Known Implementing Classes:
AnnotationDeclaration,AnnotationExpr,AnnotationMemberDeclaration,ArrayAccessExpr,ArrayCreationExpr,ArrayCreationLevel,ArrayInitializerExpr,ArrayType,AssertStmt,AssignExpr,BinaryExpr,BlockComment,BlockStmt,BodyDeclaration,BooleanLiteralExpr,BreakStmt,CallableDeclaration,CastExpr,CatchClause,CharLiteralExpr,ClassExpr,ClassOrInterfaceDeclaration,ClassOrInterfaceType,Comment,CompilationUnit,ConditionalExpr,ConstructorDeclaration,ContinueStmt,DoStmt,DoubleLiteralExpr,EmptyStmt,EnclosedExpr,EnumConstantDeclaration,EnumDeclaration,ExplicitConstructorInvocationStmt,Expression,ExpressionStmt,FieldAccessExpr,FieldDeclaration,ForeachStmt,ForStmt,IfStmt,ImportDeclaration,InitializerDeclaration,InstanceOfExpr,IntegerLiteralExpr,IntersectionType,JavadocComment,LabeledStmt,LambdaExpr,LineComment,LiteralExpr,LiteralStringValueExpr,LocalClassDeclarationStmt,LongLiteralExpr,MarkerAnnotationExpr,MemberValuePair,MethodCallExpr,MethodDeclaration,MethodReferenceExpr,ModuleDeclaration,ModuleExportsStmt,ModuleOpensStmt,ModuleProvidesStmt,ModuleRequiresStmt,ModuleStmt,ModuleUsesStmt,Name,NameExpr,Node,NodeList,NormalAnnotationExpr,NullLiteralExpr,ObjectCreationExpr,PackageDeclaration,Parameter,PrimitiveType,ReferenceType,ReturnStmt,SimpleName,SingleMemberAnnotationExpr,Statement,StringLiteralExpr,SuperExpr,SwitchEntryStmt,SwitchStmt,SynchronizedStmt,ThisExpr,ThrowStmt,TryStmt,Type,TypeDeclaration,TypeExpr,TypeParameter,UnaryExpr,UnionType,UnknownType,UnparsableStmt,VariableDeclarationExpr,VariableDeclarator,VoidType,WhileStmt,WildcardType
public interface HasParentNode<T> extends Observable
An object that has a parent node.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <N> Optional<N>getAncestorOfType(Class<N> classType)Get the ancestor of the node having the given type, or null if no ancestor of the given type is found.Optional<Node>getParentNode()Return the parent node or null, if no parent is set.NodegetParentNodeForChildren()this for everything except NodeLists.TsetParentNode(Node parentNode)Set the parent node.-
Methods inherited from interface com.github.javaparser.ast.observer.Observable
isRegistered, register, unregister
-
-
-
-
Method Detail
-
setParentNode
T setParentNode(Node parentNode)
Set the parent node.- Parameters:
parentNode- the parent node or null, to set no parent- Returns:
- return this
-
getParentNodeForChildren
Node getParentNodeForChildren()
this for everything except NodeLists. NodeLists use their parent as their children parent.
-
-