Interface PackageElement
- All Superinterfaces:
- AnnotatedConstruct, Element, QualifiedNameable
Represents a package program element.  Provides access to information
about the package and its members.
- API Note:
- The represented package may have an explicit reference
representation (either source code or executable output) or may be
created from implicit information. The explicit and standalone
source code construct for a package is typically a package-info.javafile (JLS 7.4.1). A named package without a standalonepackage-info.javafile can be declared in the package declaration of a top-level class or interface. Implicit information is used to model unnamed packages (JLS 7.4.2).In the context of annotation processing, a package element can be: - created from the initial inputs to a run of the tool
- created from source code or class files written by a processor
- queried for in the configured environment
 
- Since:
- 1.6
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionasType()Returns a pseudo-type for this package.Returns the top-level classes and interfaces within this package.Returns the enclosing module if such a module exists; otherwisenull.Returns the fully qualified name of this package.Returns the simple name of this package.booleanReturnstrueif this is an unnamed package andfalseotherwise.Methods declared in interface Elementaccept, equals, getAnnotation, getAnnotationMirrors, getAnnotationsByType, getKind, getModifiers, hashCode
- 
Method Details- 
asTypeTypeMirror asType()Returns a pseudo-type for this package.- Specified by:
- asTypein interface- Element
- Returns:
- a pseudo-type for this package
- See Also:
 
- 
getQualifiedNameName getQualifiedName()Returns the fully qualified name of this package. This is also known as the package's canonical name. For an unnamed package, an empty name is returned.- Specified by:
- getQualifiedNamein interface- QualifiedNameable
- API Note:
- The fully qualified name of a named package that is
not a subpackage of a named package is its simple name. The
fully qualified name of a named package that is a subpackage of
another named package consists of the fully qualified name of
the containing package, followed by ".", followed by the simple (member) name of the subpackage.
- Returns:
- the fully qualified name of this package, or an empty name if this is an unnamed package
- See Java Language Specification:
- 
6.7 Fully Qualified Names and Canonical Names
 
- 
getSimpleNameName getSimpleName()Returns the simple name of this package. For an unnamed package, an empty name is returned.- Specified by:
- getSimpleNamein interface- Element
- Returns:
- the simple name of this package or an empty name if this is an unnamed package
- See Also:
 
- 
getEnclosedElementsReturns the top-level classes and interfaces within this package. Note that subpackages are not considered to be enclosed by a package.- Specified by:
- getEnclosedElementsin interface- Element
- Returns:
- the top-level classes and interfaces within this package
- See Also:
 
- 
isUnnamedboolean isUnnamed()Returnstrueif this is an unnamed package andfalseotherwise.- Returns:
- trueif this is an unnamed package and- falseotherwise
- See Java Language Specification:
- 
7.4.2 Unnamed Packages
 
- 
getEnclosingElementElement getEnclosingElement()Returns the enclosing module if such a module exists; otherwisenull. One situation where a module does not exist for a package is if the environment does not include modules, such as an annotation processing environment configured for a source version without modules.- Specified by:
- getEnclosingElementin interface- Element
- Returns:
- the enclosing module if such a module exists; otherwise
null
- See Also:
 
 
-