japa.parser.ast

## Class PackageDeclaration

- java.lang.Object
- - japa.parser.ast.Node
  - - japa.parser.ast.PackageDeclaration

    public final class PackageDeclaration
    extends Node

This class represents the package declaration. The package declaration is optional for the `CompilationUnit`.

The PackageDeclaration is constructed following the syntax:
`

PackageDeclaration | ::= | ( `AnnotationExpr` )* "package" `NameExpr` ) ";"

`

Author:
  Julio Vilmar Gesser

### Field Summary

### Fields inherited from class japa.parser.ast.Node

`ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE`

### Constructor Summary

Constructors
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)`

### Method Summary

All Methods Instance Methods Concrete Methods
`<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.
`List<AnnotationExpr>` `getAnnotations()` Retrieves the list of annotations declared before the package declaration.
`NameExpr` `getName()` Return the name of the package.
`void` `setAnnotations(List<AnnotationExpr> annotations)`
`void` `setName(NameExpr name)` Sets the name of this package declaration.

### Methods inherited from class japa.parser.ast.Node

`addOrphanComment, contains, equals, getAllContainedComments, getBeginColumn, getBeginLine, getChildrenNodes, getComment, getData, getEndColumn, getEndLine, getOrphanComments, getParentNode, hashCode, isPositionedAfter, isPositionedBefore, setAsParentNodeOf, setAsParentNodeOf, setBeginColumn, setBeginLine, setComment, setData, setEndColumn, setEndLine, setParentNode, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### PackageDeclaration

    public PackageDeclaration()

#### PackageDeclaration

    public PackageDeclaration(NameExpr name)

#### PackageDeclaration

    public PackageDeclaration(List<AnnotationExpr> annotations,
                              NameExpr name)

#### PackageDeclaration

    public PackageDeclaration(int beginLine,
                              int beginColumn,
                              int endLine,
                              int endColumn,
                              List<AnnotationExpr> annotations,
                              NameExpr name)

### Method Detail

#### accept

    public <R,A> R accept(GenericVisitor<R,A> v,
                          A arg)

Description copied from class: `Node`
Accept method for visitor support.

Specified by:
  `accept` in class `Node`
Type Parameters:
  `R` - the type the return value of the visitor
  `A` - the type the argument passed to the visitor
Parameters:
  `v` - the visitor implementation
  `arg` - the argument passed to the visitor
Returns:
  the result of the visit

#### accept

    public <A> void accept(VoidVisitor<A> v,
                           A arg)

Description copied from class: `Node`
Accept method for visitor support.

Specified by:
  `accept` in class `Node`
Type Parameters:
  `A` - the type the argument passed for the visitor
Parameters:
  `v` - the visitor implementation
  `arg` - any value relevant for the visitor

#### getAnnotations

    public List<AnnotationExpr> getAnnotations()

Retrieves the list of annotations declared before the package declaration. Return `null` if there are no annotations.

Returns:
  list of annotations or `null`

#### getName

    public NameExpr getName()

Return the name of the package.

Returns:
  the name of the package

#### setAnnotations

    public void setAnnotations(List<AnnotationExpr> annotations)

Parameters:
  `annotations` - the annotations to set

#### setName

    public void setName(NameExpr name)

Sets the name of this package declaration.

Parameters:
  `name` - the name to set