Path: blob/master/src/java.compiler/share/classes/javax/lang/model/element/PackageElement.java
41161 views
/*1* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.lang.model.element;2627import java.util.List;28import javax.lang.model.type.TypeMirror;2930/**31* Represents a package program element. Provides access to information32* about the package and its members.33*34* @author Joseph D. Darcy35* @author Scott Seligman36* @author Peter von der Ahé37* @see javax.lang.model.util.Elements#getPackageOf38* @since 1.639*/40public interface PackageElement extends Element, QualifiedNameable {41/**42* {@return a {@linkplain javax.lang.model.type.NoType pseudo-type}43* for this package}44*45* @see javax.lang.model.type.NoType46* @see javax.lang.model.type.TypeKind#PACKAGE47*/48@Override49TypeMirror asType();5051/**52* Returns the fully qualified name of this package. This is also53* known as the package's <i>canonical</i> name. For an54* {@linkplain #isUnnamed() unnamed package}, an <a55* href=Name.html#empty_name>empty name</a> is returned.56*57* @apiNote The fully qualified name of a named package that is58* not a subpackage of a named package is its simple name. The59* fully qualified name of a named package that is a subpackage of60* another named package consists of the fully qualified name of61* the containing package, followed by "{@code .}", followed by the simple62* (member) name of the subpackage.63*64* @return the fully qualified name of this package, or an65* empty name if this is an unnamed package66* @jls 6.7 Fully Qualified Names and Canonical Names67*/68Name getQualifiedName();6970/**71* Returns the simple name of this package. For an {@linkplain72* #isUnnamed() unnamed package}, an <a73* href=Name.html#empty_name>empty name</a> is returned.74*75* @return the simple name of this package or an empty name if76* this is an unnamed package77*/78@Override79Name getSimpleName();8081/**82* {@return the {@linkplain NestingKind#TOP_LEVEL top-level}83* classes and interfaces within this package} Note that84* subpackages are <em>not</em> considered to be enclosed by a85* package.86*/87@Override88List<? extends Element> getEnclosedElements();8990/**91* {@return {@code true} if this is an unnamed package and {@code92* false} otherwise}93*94* @jls 7.4.2 Unnamed Packages95*/96boolean isUnnamed();9798/**99* {@return the enclosing module if such a module exists; otherwise100* {@code null}}101*102* One situation where a module does not exist for a package is if103* the environment does not include modules, such as an annotation104* processing environment configured for a {@linkplain105* javax.annotation.processing.ProcessingEnvironment#getSourceVersion106* source version} without modules.107*108* @revised 9109*/110@Override111Element getEnclosingElement();112}113114115