Interface ModuleElement
- All Superinterfaces:
-
AnnotatedConstruct
,Element
,QualifiedNameable
public interface ModuleElement extends Element, QualifiedNameable
Represents a module program element. Provides access to information about the module, its directives, and its members.
- Since:
- 9
- See Also:
Elements.getModuleOf(javax.lang.model.element.Element)
Nested Classes
Modifier and Type | Interface | Description |
---|---|---|
static interface | ModuleElement.Directive | Represents a directive within the declaration of this module. |
static class | ModuleElement.DirectiveKind | The |
static interface | ModuleElement.DirectiveVisitor<R,P> | A visitor of module directives, in the style of the visitor design pattern. |
static interface | ModuleElement.ExportsDirective | An exported package of a module. |
static interface | ModuleElement.OpensDirective | An opened package of a module. |
static interface | ModuleElement.ProvidesDirective | An implementation of a service provided by a module. |
static interface | ModuleElement.RequiresDirective | A dependency of a module. |
static interface | ModuleElement.UsesDirective | A reference to a service used by a module. |
Methods
Modifier and Type | Method | Description |
---|---|---|
List<? extends ModuleElement.Directive> | getDirectives() | Returns the directives contained in the declaration of this module. |
List<? extends Element> | getEnclosedElements() | Returns the packages within this module. |
Element | getEnclosingElement() | Returns |
Name | getQualifiedName() | Returns the fully qualified name of this module. |
Name | getSimpleName() | Returns the simple name of this module. |
boolean | isOpen() | Returns |
boolean | isUnnamed() | Returns |
Methods declared in interface javax.lang.model.AnnotatedConstruct
getAnnotationsByType
Methods declared in interface javax.lang.model.element.Element
accept, asType, equals, getAnnotation, getAnnotationMirrors, getKind, getModifiers, hashCode
Methods
getQualifiedName
Name getQualifiedName()
Returns the fully qualified name of this module. For an unnamed module, an empty name is returned.
- Specified by:
-
getQualifiedName
in interfaceQualifiedNameable
- API Note:
- If the module name consists of one identifier, then this method returns that identifier, which is deemed to be module's fully qualified name despite not being in qualified form. If the module name consists of more than one identifier, then this method returns the entire name.
- Returns:
- the fully qualified name of this module, or an empty name if this is an unnamed module
getSimpleName
Name getSimpleName()
Returns the simple name of this module. For an unnamed module, an empty name is returned.
- Specified by:
-
getSimpleName
in interfaceElement
- API Note:
- If the module name consists of one identifier, then this method returns that identifier. If the module name consists of more than one identifier, then this method returns the rightmost such identifier, which is deemed to be the module's simple name.
- Returns:
- the simple name of this module or an empty name if this is an unnamed module
- See Also:
-
PackageElement.getSimpleName()
,ExecutableElement.getSimpleName()
,TypeElement.getSimpleName()
,VariableElement.getSimpleName()
,getSimpleName()
getEnclosedElements
List<? extends Element> getEnclosedElements()
Returns the packages within this module.
- Specified by:
-
getEnclosedElements
in interfaceElement
- Returns:
- the packages within this module
- See Also:
-
TypeElement.getEnclosedElements()
,PackageElement.getEnclosedElements()
,getEnclosedElements()
,Elements.getAllMembers(javax.lang.model.element.TypeElement)
isOpen
boolean isOpen()
Returns true
if this is an open module and
false
otherwise.
- Returns:
-
true
if this is an open module andfalse
otherwise
isUnnamed
boolean isUnnamed()
Returns true
if this is an unnamed module and
false
otherwise.
- Returns:
-
true
if this is an unnamed module andfalse
otherwise
getEnclosingElement
Element getEnclosingElement()
Returns null
since a module is not enclosed by another element.
- Specified by:
-
getEnclosingElement
in interfaceElement
- Returns:
null
- See Also:
Elements.getPackageOf(javax.lang.model.element.Element)
getDirectives
List<? extends ModuleElement.Directive> getDirectives()
Returns the directives contained in the declaration of this module.
- Returns:
- the directives in the declaration of this module
© 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/11/docs/api/java.compiler/javax/lang/model/element/ModuleElement.html