API Note
The represented module 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 module is typically a 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:
javax.lang.model.util.Elements#getModuleOf
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ModuleElement.
Represents a directive within the declaration of this module. |
| public static enum | ModuleElement.
The |
| public static interface | ModuleElement.
the return type of this visitor's methods. Use R, Void for visitors that do not need to return results.the type of the additional parameter to this visitor's
methods. Use P>Void for visitors that do not need an
additional parameter.A visitor of module directives, in the style of the visitor design pattern. |
| public static interface | ModuleElement.
An exported package of a module. |
| public static interface | ModuleElement.
An opened package of a module. |
| public static interface | ModuleElement.
An implementation of a service provided by a module. |
| public static interface | ModuleElement.
A dependency of a module. |
| public static interface | ModuleElement.
A reference to a service used by a module. |
| Modifier and Type | Method and Description |
|---|---|
| public TypeMirror | Returns: a pseudo-type for this moduleRedeclares javax. Returns a pseudo-type for this module. |
| public List | Returns: the directives in the declaration of this moduleReturns the directives contained in the declaration of this module. |
| public List | Returns: the packages within this moduleRedeclares javax. Returns the packages within this module. |
| public Element | Returns: nullRedeclares javax. Returns |
| public Name | Returns: the fully qualified name of this module, or an empty name if this is an unnamed moduleRedeclares javax. Returns the fully qualified name of this module. |
| public Name | Returns: the simple name of this module or an empty name if this is an unnamed moduleRedeclares javax. Returns the simple name of this module. |
| public boolean | Returns: true if this is an open module and false otherwiseReturns |
| public boolean | Returns: true if this is an unnamed module and false otherwiseReturns |
| asType | back to summary |
|---|---|
| public TypeMirror asType() Redeclares javax. Returns a pseudo-type for this module.
| |
| getDirectives | back to summary |
|---|---|
| public List Returns the directives contained in the declaration of this module.
| |
| getEnclosedElements | back to summary |
|---|---|
| public List Redeclares javax. Returns the packages within this module. | |
| getEnclosingElement | back to summary |
|---|---|
| public Element getEnclosingElement() Redeclares javax. Returns | |
| getQualifiedName | back to summary |
|---|---|
| public Name getQualifiedName() Redeclares javax. Returns the fully qualified name of this module. For an unnamed module, an empty name is returned. 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.
| |
| getSimpleName | back to summary |
|---|---|
| public Name getSimpleName() Redeclares javax. Returns the simple name of this module. For an unnamed module, an empty name is returned. 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.
| |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Returns
| |
| isUnnamed | back to summary |
|---|---|
| public boolean isUnnamed() Returns
| |
| Modifier and Type | Method and Description |
|---|---|
| public < the return type of the visitor's methods R, the type of the additional parameter to the visitor's methods P> R | Returns: a visitor-specified resultthe visitor operating on this directive v,additional parameter to the visitor p)Applies a visitor to this directive. |
| public ModuleElement. |
| accept | back to summary |
|---|---|
| public <R, P> R accept(ModuleElement. Applies a visitor to this directive.
| |
| getKind | back to summary |
|---|---|
| public ModuleElement. Returns the
| |
kind of a directive.
Note that it is possible additional directive kinds will be added to accommodate new, currently unknown, language structures added to future versions of the Java programming language.
| Modifier and Type | Field and Description |
|---|---|
| public static final ModuleElement. | EXPORTS
An "exports package-name [to module-name-list]" directive. |
| public static final ModuleElement. | OPENS
An "opens package-name [to module-name-list]" directive. |
| public static final ModuleElement. | PROVIDES
A "provides service-name with implementation-name" directive. |
| public static final ModuleElement. | REQUIRES
A "requires (static|transitive)* module-name" directive. |
| public static final ModuleElement. | USES
A "uses service-name" directive. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ModuleElement. | |
| public static ModuleElement. |
| EXPORTS | back to summary |
|---|---|
| public static final ModuleElement. An "exports package-name [to module-name-list]" directive. | |
| OPENS | back to summary |
|---|---|
| public static final ModuleElement. An "opens package-name [to module-name-list]" directive. | |
| PROVIDES | back to summary |
|---|---|
| public static final ModuleElement. A "provides service-name with implementation-name" directive. | |
| REQUIRES | back to summary |
|---|---|
| public static final ModuleElement. A "requires (static|transitive)* module-name" directive. | |
| USES | back to summary |
|---|---|
| public static final ModuleElement. A "uses service-name" directive. | |
| DirectiveKind | back to summary |
|---|---|
| private DirectiveKind() | |
| valueOf | back to summary |
|---|---|
| public static ModuleElement. | |
| values | back to summary |
|---|---|
| public static ModuleElement. | |
Void for visitors that do not need to return results.
Void for visitors that do not need an
additional parameter.
accept method, the visitXyz method applicable
to that directive is invoked.
Classes implementing this interface may or may not throw a
NullPointerException if the additional parameter p
is null; see documentation of the implementing class for
details.
Warning
It is possible that methods will be added to this interface to accommodate new, currently unknown, language structures added to future versions of the Java programming language. Methods to accommodate new language constructs will be added in a source compatible way using default methods.
| Modifier and Type | Method and Description |
|---|---|
| public default R | Returns: a visitor-specified resultthe directive to visit dVisits any directive as if by passing itself to that
directive's |
| public default R | Returns: a visitor-specified resultthe directive to visit d,a visitor-specified parameter p)Visits any directive as if by passing itself to that
directive's |
| public R | Returns: a visitor-specified resultthe directive to visit d,a visitor-specified parameter p)Visits an |
| public R | Returns: a visitor-specified resultthe directive to visit d,a visitor-specified parameter p)Visits an |
| public R | Returns: a visitor-specified resultthe directive to visit d,a visitor-specified parameter p)Visits a |
| public R | Returns: a visitor-specified resultthe directive to visit d,a visitor-specified parameter p)Visits a |
| public default R | Returns: a visitor-specified resultthe directive to visit d,a visitor-specified parameter p)Visits an unknown directive. |
| public R | Returns: a visitor-specified resultthe directive to visit d,a visitor-specified parameter p)Visits a |
| visit | back to summary |
|---|---|
| public default R visit(ModuleElement. Visits any directive as if by passing itself to that
directive's Implementation Specification The default implementation is
| |
| visit | back to summary |
|---|---|
| public default R visit(ModuleElement. Visits any directive as if by passing itself to that
directive's Implementation Specification The default implementation is
| |
| visitExports | back to summary |
|---|---|
| public R visitExports(ModuleElement. Visits an
| |
| visitOpens | back to summary |
|---|---|
| public R visitOpens(ModuleElement. Visits an
| |
| visitProvides | back to summary |
|---|---|
| public R visitProvides(ModuleElement. Visits a
| |
| visitRequires | back to summary |
|---|---|
| public R visitRequires(ModuleElement. Visits a
| |
| visitUnknown | back to summary |
|---|---|
| public default R visitUnknown(ModuleElement. Visits an unknown directive. This can occur if the language evolves and new kinds of directive are added. Implementation Specification The default implementation throws
| |
| visitUses | back to summary |
|---|---|
| public R visitUses(ModuleElement. Visits a
| |
| Modifier and Type | Method and Description |
|---|---|
| public PackageElement | |
| public List | Returns: the specific modules to which the package is being exportedReturns the specific modules to which the package is being exported,
or |
| getPackage | back to summary |
|---|---|
| public PackageElement getPackage() Returns the package being exported.
| |
| getTargetModules | back to summary |
|---|---|
| public List Returns the specific modules to which the package is being exported,
or
| |
| Modifier and Type | Method and Description |
|---|---|
| public PackageElement | |
| public List | Returns: the specific modules to which the package is being openedReturns the specific modules to which the package is being open
or |
| getPackage | back to summary |
|---|---|
| public PackageElement getPackage() Returns the package being opened.
| |
| getTargetModules | back to summary |
|---|---|
| public List Returns the specific modules to which the package is being open
or
| |
| Modifier and Type | Method and Description |
|---|---|
| public List | Returns: the implementations of the service being providedReturns the implementations of the service being provided. |
| public TypeElement |
| getImplementations | back to summary |
|---|---|
| public List Returns the implementations of the service being provided.
| |
| getService | back to summary |
|---|---|
| public TypeElement getService() Returns the service being provided.
| |
| Modifier and Type | Method and Description |
|---|---|
| public ModuleElement | |
| public boolean | Returns: whether or not this is a static dependencyReturns whether or not this is a static dependency. |
| public boolean | Returns: whether or not this is a transitive dependencyReturns whether or not this is a transitive dependency. |
| getDependency | back to summary |
|---|---|
| public ModuleElement getDependency() Returns the module that is required.
| |
| isStatic | back to summary |
|---|---|
| public boolean isStatic() Returns whether or not this is a static dependency.
| |
| isTransitive | back to summary |
|---|---|
| public boolean isTransitive() Returns whether or not this is a transitive dependency.
| |
| Modifier and Type | Method and Description |
|---|---|
| public TypeElement |
| getService | back to summary |
|---|---|
| public TypeElement getService() Returns the service that is used.
| |