public final class PackageDeclaration extends Node implements NodeWithAnnotations<PackageDeclaration>
This class represents the package declaration. The package declaration is
optional for the CompilationUnit.
PackageDeclaration ::= (AnnotationExpr)* "package"NameExpr) ";"
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration| Constructor and Description |
|---|
PackageDeclaration() |
PackageDeclaration(NameExpr name) |
PackageDeclaration(NodeList<AnnotationExpr> annotations,
NameExpr name) |
PackageDeclaration(Range range,
NodeList<AnnotationExpr> annotations,
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.
|
NodeList<AnnotationExpr> |
getAnnotations()
Retrieves the list of annotations declared before the package
declaration.
|
NameExpr |
getName()
Return the name expression of the package.
|
String |
getPackageName()
Get full package name.
|
PackageDeclaration |
setAnnotations(NodeList<AnnotationExpr> annotations) |
PackageDeclaration |
setName(NameExpr name)
Sets the name of this package declaration.
|
addOrphanComment, clone, containsWithin, equals, getAllContainedComments, getBegin, getChildNodes, getComment, getEnd, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getRange, getUserData, hasComment, hashCode, isPositionedAfter, isPositionedBefore, remove, setAsParentNodeOf, setBegin, setBlockComment, setComment, setEnd, setLineComment, setParentNode, setRange, setUserData, toString, toString, tryAddImportToParentCompilationUnitfinalize, getClass, notify, notifyAll, wait, wait, waitaddAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresentgetAncestorOfType, setAsParentNodeOf, setAsParentNodeOfpublic PackageDeclaration()
public PackageDeclaration(NameExpr name)
public PackageDeclaration(NodeList<AnnotationExpr> annotations, NameExpr name)
public PackageDeclaration(Range range, NodeList<AnnotationExpr> annotations, NameExpr name)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitableaccept in interface VisitableR - 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)
Visitablepublic NodeList<AnnotationExpr> getAnnotations()
null if there are no annotations.getAnnotations in interface NodeWithAnnotations<PackageDeclaration>nullpublic NameExpr getName()
public String getPackageName()
public PackageDeclaration setAnnotations(NodeList<AnnotationExpr> annotations)
setAnnotations in interface NodeWithAnnotations<PackageDeclaration>annotations - the annotations to setpublic PackageDeclaration setName(NameExpr name)
name - the name to setCopyright © 2007–2016. All rights reserved.