public final class PackageDeclaration extends Node implements NodeWithAnnotations<PackageDeclaration>, NodeWithName<PackageDeclaration>
package com.github.javaparser.ast;
@Wonderful package anything.can.be.annotated.nowadays;
Node.ObserverRegistrationMode, Node.Parsedness
Modifier and Type | Field and Description |
---|---|
private NodeList<AnnotationExpr> |
annotations |
private Name |
name |
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
Constructor and Description |
---|
PackageDeclaration() |
PackageDeclaration(Name name) |
PackageDeclaration(NodeList<AnnotationExpr> annotations,
Name name) |
PackageDeclaration(TokenRange tokenRange,
NodeList<AnnotationExpr> annotations,
Name name)
This constructor is used by the parser and is considered private.
|
Modifier and Type | Method and Description |
---|---|
<R,A> R |
accept(GenericVisitor<R,A> v,
A arg)
Accept method for visitor support.
|
<A> void |
accept(VoidVisitor<A> v,
A arg)
Accept method for visitor support.
|
PackageDeclaration |
clone() |
NodeList<AnnotationExpr> |
getAnnotations()
Retrieves the list of annotations declared before the package
declaration.
|
PackageDeclarationMetaModel |
getMetaModel() |
Name |
getName()
Return the name expression of the package.
|
java.util.List<NodeList<?>> |
getNodeLists()
The list of NodeLists owned by this node.
|
boolean |
remove(Node node) |
boolean |
replace(Node node,
Node replacementNode) |
PackageDeclaration |
setAnnotations(NodeList<AnnotationExpr> annotations) |
PackageDeclaration |
setName(Name name)
Sets the name of this package declaration.
|
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
finalize, getClass, notify, notifyAll, wait, wait, wait
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnit
getNameAsString, setName
getAncestorOfType
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
private NodeList<AnnotationExpr> annotations
private Name name
public PackageDeclaration()
public PackageDeclaration(Name name)
public PackageDeclaration(NodeList<AnnotationExpr> annotations, Name name)
@Generated(value="com.github.javaparser.generator.core.node.MainConstructorGenerator") public PackageDeclaration(TokenRange tokenRange, NodeList<AnnotationExpr> annotations, Name name)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitable
accept
in interface Visitable
R
- the type of the return value of the visitorA
- the type the user argument passed to the visitorv
- the visitor implementationarg
- the argument passed to the visitor (of type A)public <A> void accept(VoidVisitor<A> v, A arg)
Visitable
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public NodeList<AnnotationExpr> getAnnotations()
null
if there are no annotations.getAnnotations
in interface NodeWithAnnotations<PackageDeclaration>
null
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public Name getName()
getName
in interface NodeWithName<PackageDeclaration>
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public PackageDeclaration setAnnotations(NodeList<AnnotationExpr> annotations)
setAnnotations
in interface NodeWithAnnotations<PackageDeclaration>
annotations
- the annotations to set@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public PackageDeclaration setName(Name name)
setName
in interface NodeWithName<PackageDeclaration>
name
- the name to set@Generated(value="com.github.javaparser.generator.core.node.GetNodeListsGenerator") public java.util.List<NodeList<?>> getNodeLists()
Node
getNodeLists
in class Node
@Generated(value="com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
@Generated(value="com.github.javaparser.generator.core.node.CloneGenerator") public PackageDeclaration clone()
@Generated(value="com.github.javaparser.generator.core.node.GetMetaModelGenerator") public PackageDeclarationMetaModel getMetaModel()
getMetaModel
in class Node