public final class PackageDeclaration extends Node implements NodeWithAnnotations<PackageDeclaration>, NodeWithName<PackageDeclaration>
This class represents the package declaration. The package declaration is
optional for the CompilationUnit
.
PackageDeclaration ::= (
AnnotationExpr
)* "package"
NameExpr
) ";"
Node.ObserverRegistrationMode
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(Range range,
NodeList<AnnotationExpr> annotations,
Name 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.
|
Name |
getName()
Return the name expression of the package.
|
List<NodeList<?>> |
getNodeLists()
The list of NodeLists owned by this node.
|
String |
getPackageName()
Get full package name.
|
PackageDeclaration |
setAnnotations(NodeList<AnnotationExpr> annotations) |
PackageDeclaration |
setName(Name name)
Sets the name of this package declaration.
|
addOrphanComment, clone, containsWithin, equals, getAllContainedComments, getBegin, getChildNodes, getComment, getData, getEnd, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getRange, hasComment, hashCode, isPositionedAfter, isPositionedBefore, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, setAsParentNodeOf, setBegin, setBlockComment, setComment, setData, setEnd, setLineComment, setParentNode, setRange, toString, toString, tryAddImportToParentCompilationUnit, unregister
finalize, getClass, notify, notifyAll, wait, wait, wait
addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent
getNameAsString, setName
getAncestorOfType, setAsParentNodeOf, setAsParentNodeOf
public PackageDeclaration()
public PackageDeclaration(Name name)
public PackageDeclaration(NodeList<AnnotationExpr> annotations, Name name)
public PackageDeclaration(Range range, 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
public NodeList<AnnotationExpr> getAnnotations()
null
if there are no annotations.getAnnotations
in interface NodeWithAnnotations<PackageDeclaration>
null
public Name getName()
getName
in interface NodeWithName<PackageDeclaration>
public String getPackageName()
public PackageDeclaration setAnnotations(NodeList<AnnotationExpr> annotations)
setAnnotations
in interface NodeWithAnnotations<PackageDeclaration>
annotations
- the annotations to setpublic PackageDeclaration setName(Name name)
setName
in interface NodeWithName<PackageDeclaration>
name
- the name to setpublic List<NodeList<?>> getNodeLists()
Node
getNodeLists
in class Node
Copyright © 2007–2016. All rights reserved.