- All Superinterfaces:
Tree
Represents the abstract syntax tree for compilation units (source
files) and package declarations (package-info.java).
- See Java Language Specification:
-
7.3 Compilation Units
7.4 Package Declarations - Since:
- 1.6
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionList<? extends ImportTree>
Returns the import declarations appearing in this compilation unit.Returns the line map for this compilation unit, if available.Returns the package tree associated with this compilation unit, ornull
if there is no package declaration.List<? extends AnnotationTree>
Returns the annotations listed on any package declaration at the head of this compilation unit, ornull
if there is no package declaration.Returns the name contained in any package declaration at the head of this compilation unit, ornull
if there is no package declaration.Returns the file object containing the source for this compilation unit.Returns the type declarations appearing in this compilation unit.
-
Method Details
-
getPackageAnnotations
List<? extends AnnotationTree> getPackageAnnotations()Returns the annotations listed on any package declaration at the head of this compilation unit, ornull
if there is no package declaration.- Returns:
- the package annotations
-
getPackageName
ExpressionTree getPackageName()Returns the name contained in any package declaration at the head of this compilation unit, ornull
if there is no package declaration.- Returns:
- the package name
-
getPackage
PackageTree getPackage()Returns the package tree associated with this compilation unit, ornull
if there is no package declaration.- Returns:
- the package tree
- Since:
- 9
-
getImports
List<? extends ImportTree> getImports()Returns the import declarations appearing in this compilation unit.- Returns:
- the import declarations
-
getTypeDecls
Returns the type declarations appearing in this compilation unit. The list may also include empty statements resulting from extraneous semicolons.- Returns:
- the type declarations
-
getSourceFile
JavaFileObject getSourceFile()Returns the file object containing the source for this compilation unit.- Returns:
- the file object
-
getLineMap
LineMap getLineMap()Returns the line map for this compilation unit, if available. Returnsnull
if the line map is not available.- Returns:
- the line map for this compilation unit
-