AnnotatedConstruct
, Element
, QualifiedNameable
public interface ModuleElement extends Element, QualifiedNameable
module-info.java
file (JLS 7.7). Automatic modules (JLS 7.7.1) are named modules that do not have a module-info
file. Implicit information is used to model unnamed modules. In the context of annotation processing, a module element can be:
Modifier and Type | Interface | Description |
---|---|---|
static interface |
ModuleElement.Directive |
Represents a directive within the declaration of this module. |
static enum |
ModuleElement.DirectiveKind |
The kind of a directive. |
static interface |
ModuleElement.DirectiveVisitor<R, |
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. |
Modifier and Type | Method | Description |
---|---|---|
TypeMirror |
asType() |
Returns a pseudo-type for this module. |
List |
getDirectives() |
Returns the directives contained in the declaration of this module. |
List |
getEnclosedElements() |
Returns the packages within this module. |
Element |
getEnclosingElement() |
Returns null since a module is not enclosed by another element. |
Name |
getQualifiedName() |
Returns the fully qualified name of this module. |
Name |
getSimpleName() |
Returns the simple name of this module. |
boolean |
isOpen() |
Returns true if this is an open module and
false otherwise. |
boolean |
isUnnamed() |
Returns true if this is an unnamed module and
false otherwise. |
accept, equals, getAnnotation, getAnnotationMirrors, getAnnotationsByType, getKind, getModifiers, hashCode
TypeMirror asType()
asType
in interface Element
Name getQualifiedName()
getQualifiedName
in interface QualifiedNameable
Name getSimpleName()
getSimpleName
in interface Element
List<? extends Element> getEnclosedElements()
getEnclosedElements
in interface Element
boolean isOpen()
true
if this is an open module and
false
otherwise.true
if this is an open module and
false
otherwiseboolean isUnnamed()
true
if this is an unnamed module and
false
otherwise.true
if this is an unnamed module and
false
otherwiseElement getEnclosingElement()
null
since a module is not enclosed by another element.getEnclosingElement
in interface Element
null
List<? extends ModuleElement.Directive> getDirectives()
© 1993, 2023, 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/21/docs/api/java.compiler/javax/lang/model/element/ModuleElement.html