public final class PackageDeclaration extends Node
This class represents the package declaration. The package declaration is optional for the
CompilationUnit.
PackageDeclaration
::=
( AnnotationExpr )* "package" NameExpr ) ";"
| Constructor and Description |
|---|
PackageDeclaration() |
PackageDeclaration(int beginLine,
int beginColumn,
int endLine,
int endColumn,
List<AnnotationExpr> annotations,
NameExpr name) |
PackageDeclaration(List<AnnotationExpr> annotations,
NameExpr name) |
PackageDeclaration(NameExpr name) |
| 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() |
List<AnnotationExpr> |
getAnnotations()
Retrieves the list of annotations declared before the package declaration.
|
List<Node> |
getChildren() |
NameExpr |
getName()
Return the name of the package.
|
boolean |
removeChild(Node child) |
boolean |
replaceChildNode(Node oldChild,
Node newChild) |
void |
setAnnotations(List<AnnotationExpr> annotations) |
void |
setName(NameExpr name)
Sets the name of this package declaration.
|
check, clone, clone, contains, diableConstraints, enableConstraints, equals, getBeginColumn, getBeginLine, getCommonAncestor, getConstraints, getData, getEndColumn, getEndLine, getParentNode, getPrettySource, getPrettySource, hashCode, isAncestorOf, isInEqualLocation, isNewNode, isPreviousThan, remove, replaceChildNodeInList, setAsParentNodeOf, setAsParentNodeOf, setBeginColumn, setBeginLine, setConstraints, setData, setEndColumn, setEndLine, toString, updateReferencespublic PackageDeclaration()
public PackageDeclaration(NameExpr name)
public PackageDeclaration(List<AnnotationExpr> annotations, NameExpr name)
public PackageDeclaration(int beginLine,
int beginColumn,
int endLine,
int endColumn,
List<AnnotationExpr> annotations,
NameExpr name)
public boolean removeChild(Node child)
removeChild in class Nodepublic List<Node> getChildren()
getChildren in class Nodepublic <R,A> R accept(GenericVisitor<R,A> v, A arg)
Nodepublic <A> void accept(VoidVisitor<A> v, A arg)
Nodepublic List<AnnotationExpr> getAnnotations()
null if there are no annotations.nullpublic NameExpr getName()
public void setAnnotations(List<AnnotationExpr> annotations)
annotations - the annotations to setpublic void setName(NameExpr name)
name - the name to setpublic boolean replaceChildNode(Node oldChild, Node newChild)
replaceChildNode in class Nodepublic PackageDeclaration clone() throws CloneNotSupportedException
clone in class NodeCloneNotSupportedExceptionCopyright © 2018. All rights reserved.