Class BodyDeclaration<T extends BodyDeclaration<?>>
java.lang.Object
com.github.javaparser.ast.Node
com.github.javaparser.ast.body.BodyDeclaration<T>
- All Implemented Interfaces:
NodeWithAnnotations<T>, NodeWithRange<Node>, NodeWithTokenRange<Node>, Observable, Visitable, HasParentNode<Node>, Cloneable
- Direct Known Subclasses:
AnnotationMemberDeclaration, CallableDeclaration, CompactConstructorDeclaration, EnumConstantDeclaration, FieldDeclaration, InitializerDeclaration, TypeDeclaration
public abstract class BodyDeclaration<T extends BodyDeclaration<?>>
extends Node
implements NodeWithAnnotations<T>
Any declaration that can appear between the { and } of a class, interface, enum, or record.
-
Nested Class Summary
Nested classes/interfaces inherited from class Node
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversal -
Field Summary
FieldsFields inherited from class Node
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, LINE_SEPARATOR_KEY, NODE_BY_BEGIN_POSITION, PHANTOM_KEY, prettyPrinterNoCommentsConfiguration, PRINTER_KEY, SYMBOL_RESOLVER_KEY -
Constructor Summary
ConstructorsModifierConstructorDescriptionBodyDeclaration(NodeList<AnnotationExpr> annotations) protectedBodyDeclaration(TokenRange range) BodyDeclaration(TokenRange tokenRange, NodeList<AnnotationExpr> annotations) This constructor is used by the parser and is considered private. -
Method Summary
Modifier and TypeMethodDescriptionclone()voidvoidvoidvoidvoidvoidvoidvoidifEnumDeclaration(Consumer<EnumDeclaration> action) voidifFieldDeclaration(Consumer<FieldDeclaration> action) voidvoidifMethodDeclaration(Consumer<MethodDeclaration> action) voidifRecordDeclaration(Consumer<RecordDeclaration> action) voidifTypeDeclaration(Consumer<TypeDeclaration> action) booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleansetAnnotations(NodeList<AnnotationExpr> annotations) Methods inherited from class Node
addOrphanComment, containsData, createDefaultPrinter, createDefaultPrinter, customInitialization, equals, findAll, findAll, findAll, findByRange, findCompilationUnit, findData, findFirst, findFirst, findFirst, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getDataKeys, getDefaultPrinterConfiguration, getLineEndingStyle, getLineEndingStyleOrDefault, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getPrinter, getPrinter, getRange, getSymbolResolver, getTokenRange, hashCode, hasScope, isAncestorOf, isPhantom, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walkMethods inherited from interface HasParentNode
findAncestor, findAncestor, findAncestor, hasParentNode, isDescendantOfMethods inherited from interface NodeWithAnnotations
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnitMethods inherited from interface NodeWithRange
containsWithin, containsWithinRange, getBegin, getEnd, hasRange
-
Field Details
-
annotations
-
-
Constructor Details
-
BodyDeclaration
public BodyDeclaration() -
BodyDeclaration
-
BodyDeclaration
This constructor is used by the parser and is considered private. -
BodyDeclaration
-
-
Method Details
-
getAnnotations
- Specified by:
getAnnotationsin interfaceNodeWithAnnotations<T extends BodyDeclaration<?>>
-
setAnnotations
- Specified by:
setAnnotationsin interfaceNodeWithAnnotations<T extends BodyDeclaration<?>>
-
remove
-
clone
-
getMetaModel
- Overrides:
getMetaModelin classNode- Returns:
- get JavaParser specific node introspection information.
-
replace
-
isAnnotationDeclaration
public boolean isAnnotationDeclaration() -
asAnnotationDeclaration
-
isAnnotationMemberDeclaration
public boolean isAnnotationMemberDeclaration() -
asAnnotationMemberDeclaration
-
isCallableDeclaration
public boolean isCallableDeclaration() -
asCallableDeclaration
-
isClassOrInterfaceDeclaration
public boolean isClassOrInterfaceDeclaration() -
asClassOrInterfaceDeclaration
-
isConstructorDeclaration
public boolean isConstructorDeclaration() -
asConstructorDeclaration
-
isCompactConstructorDeclaration
public boolean isCompactConstructorDeclaration() -
asCompactConstructorDeclaration
-
isEnumConstantDeclaration
public boolean isEnumConstantDeclaration() -
asEnumConstantDeclaration
-
isEnumDeclaration
public boolean isEnumDeclaration() -
asEnumDeclaration
-
isFieldDeclaration
public boolean isFieldDeclaration() -
asFieldDeclaration
-
isInitializerDeclaration
public boolean isInitializerDeclaration() -
asInitializerDeclaration
-
isMethodDeclaration
public boolean isMethodDeclaration() -
asMethodDeclaration
-
isTypeDeclaration
public boolean isTypeDeclaration() -
asTypeDeclaration
-
ifAnnotationDeclaration
-
ifAnnotationMemberDeclaration
-
ifCallableDeclaration
-
ifClassOrInterfaceDeclaration
-
ifConstructorDeclaration
-
ifEnumConstantDeclaration
-
ifEnumDeclaration
-
ifFieldDeclaration
-
ifInitializerDeclaration
-
ifMethodDeclaration
-
ifTypeDeclaration
-
ifRecordDeclaration
-
ifCompactConstructorDeclaration
-
toAnnotationDeclaration
-
toAnnotationMemberDeclaration
-
toCallableDeclaration
-
toClassOrInterfaceDeclaration
-
toConstructorDeclaration
-
toEnumConstantDeclaration
-
toEnumDeclaration
-
toFieldDeclaration
-
toInitializerDeclaration
-
toMethodDeclaration
-
toTypeDeclaration
-
isRecordDeclaration
public boolean isRecordDeclaration() -
asRecordDeclaration
-
toRecordDeclaration
-
toCompactConstructorDeclaration
-