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
,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, or enum.- Author:
- Julio Vilmar Gesser
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.github.javaparser.ast.Node
Node.ObserverRegistrationMode, Node.Parsedness
-
-
Field Summary
-
Fields inherited from class com.github.javaparser.ast.Node
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
-
-
Constructor Summary
Constructors Modifier Constructor Description BodyDeclaration()
BodyDeclaration(NodeList<AnnotationExpr> annotations)
protected
BodyDeclaration(TokenRange range)
BodyDeclaration(TokenRange tokenRange, NodeList<AnnotationExpr> annotations)
This constructor is used by the parser and is considered private.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BodyDeclaration<?>
clone()
NodeList<AnnotationExpr>
getAnnotations()
BodyDeclarationMetaModel
getMetaModel()
List<NodeList<?>>
getNodeLists()
The list of NodeLists owned by this node.boolean
remove(Node node)
boolean
replace(Node node, Node replacementNode)
T
setAnnotations(NodeList<AnnotationExpr> annotations)
-
Methods inherited from class com.github.javaparser.ast.Node
addOrphanComment, customInitialization, equals, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getTokenRange, hasComment, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, toString, toString, tryAddImportToParentCompilationUnit, unregister
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.HasParentNode
getAncestorOfType
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithAnnotations
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnit
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithRange
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
-
-
-
-
Constructor Detail
-
BodyDeclaration
public BodyDeclaration()
-
BodyDeclaration
public BodyDeclaration(NodeList<AnnotationExpr> annotations)
-
BodyDeclaration
@Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") public BodyDeclaration(TokenRange tokenRange, NodeList<AnnotationExpr> annotations)
This constructor is used by the parser and is considered private.
-
BodyDeclaration
protected BodyDeclaration(TokenRange range)
-
-
Method Detail
-
getAnnotations
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public NodeList<AnnotationExpr> getAnnotations()
- Specified by:
getAnnotations
in interfaceNodeWithAnnotations<T extends BodyDeclaration<?>>
-
setAnnotations
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public T setAnnotations(NodeList<AnnotationExpr> annotations)
- Specified by:
setAnnotations
in interfaceNodeWithAnnotations<T extends BodyDeclaration<?>>
-
getNodeLists
public List<NodeList<?>> getNodeLists()
Description copied from class:Node
The list of NodeLists owned by this node.- Overrides:
getNodeLists
in classNode
-
remove
@Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
-
clone
@Generated("com.github.javaparser.generator.core.node.CloneGenerator") public BodyDeclaration<?> clone()
-
getMetaModel
@Generated("com.github.javaparser.generator.core.node.GetMetaModelGenerator") public BodyDeclarationMetaModel getMetaModel()
- Overrides:
getMetaModel
in classNode
- Returns:
- get JavaParser specific node introspection information.
-
replace
@Generated("com.github.javaparser.generator.core.node.ReplaceMethodGenerator") public boolean replace(Node node, Node replacementNode)
-
-