Package com.github.javaparser.ast.body
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.
- Author:
- Julio Vilmar Gesser
-
Nested Class Summary
Nested classes/interfaces inherited from class com.github.javaparser.ast.Node
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversal -
Field Summary
Fields inherited from class com.github.javaparser.ast.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()voidvoidvoidifCallableDeclaration(Consumer<CallableDeclaration> action)voidvoidvoidvoidvoidifEnumDeclaration(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 com.github.javaparser.ast.Node
addOrphanComment, containsData, createDefaultPrinter, createDefaultPrinter, customInitialization, equals, findAll, findAll, findAll, findCompilationUnit, 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 class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.github.javaparser.HasParentNode
findAncestor, findAncestor, hasParentNode, isDescendantOfMethods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithAnnotations
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnitMethods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithRange
containsWithin, containsWithinRange, getBegin, getEnd, hasRange
-
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
-