|
FlexDoc/Javadoc 2.0 Demo Java Doc |
Named modules have a name and are constructed by the Java Virtual Machine when a graph of modules is defined to the Java virtual machine to create a module layer.
An unnamed module does not have a name. There is an unnamed module for each ClassLoader, obtained by invoking its getUnnamedModule method. All types that are not in a named module are members of their defining class loader's unnamed module.
The package names that are parameters or returned by methods defined in this class are the fully-qualified names of the packages as defined in section {@jls 6.5.3} of The Java Language Specification, for example, "java.lang".
Unless otherwise specified, passing a null argument to a method in this class causes a NullPointerException to be thrown.
Method Summary |
||
If the caller's module is this module then update this module to export
the given package to the given module.
|
||
If this module has opened a package to at least the caller
module then update this module to open the package to the given module.
|
||
If the caller's module is this module then update this module to read
the given module.
|
||
If the caller's module is this module then update this module to add a
service dependence on the given service type.
|
||
boolean |
Indicates if this module reads the given module.
|
|
boolean |
Indicates if this module has a service dependence on the given service
type.
|
|
Returns this element's annotation for the specified type if
such an annotation is present, else null.
This method returns null when invoked on an unnamed module.
|
||
Returns annotations that are present on this element.
This method returns an empty array when invoked on an unnamed module.
|
||
Returns the ClassLoader for this module.
|
||
Returns annotations that are directly present on this element.
This method returns an empty array when invoked on an unnamed module.
|
||
Returns the module descriptor for this module or null if this
module is an unnamed module.
|
||
getLayer()
Returns the module layer that contains this module or null if
this module is not in a module layer.
|
||
getName()
Returns the module name or null if this module is an unnamed
module.
|
||
Returns the set of package names for the packages in this module.
|
||
getResourceAsStream(String name)
Returns an input stream for reading a resource in this module.
|
||
boolean |
isExported(String pn)
Returns true if this module exports the given package
unconditionally.
|
|
boolean |
Returns true if this module exports the given package to at
least the given module.
|
|
boolean |
isNamed()
Returns true if this module is a named module.
|
|
boolean |
Returns true if this module has opened a package
unconditionally.
|
|
boolean |
Returns true if this module has opened a package to at
least the given module.
|
|
toString()
Returns the string representation of this module.
|
Methods inherited from class java.lang.Object |
Methods inherited from interface java.lang.reflect.AnnotatedElement |
public boolean isNamed |
() |
public String getName |
() |
public ClassLoader getClassLoader |
() |
If there is a security manager then its checkPermission method if first called with a RuntimePermission("getClassLoader") permission to check that the caller is allowed to get access to the class loader.
public ModuleDescriptor getDescriptor |
() |
public ModuleLayer getLayer |
() |
Dynamic modules are named modules that are generated at runtime. A dynamic module may or may not be in a module layer.
public boolean canRead |
(Module other) |
public Module addReads |
(Module other) |
public boolean isExported |
This method returns true if invoked to test if a package in this module is exported to itself. It always returns true when invoked on an unnamed module. A package that is open to the given module is considered exported to that module at run-time and so this method returns true if the package is open to the given module.
This method does not check if the given module reads this module.
public boolean isOpen |
This method returns true if invoked to test if a package in this module is open to itself. It returns true when invoked on an open module with a package in the module. It always returns true when invoked on an unnamed module.
This method does not check if the given module reads this module.
public boolean isExported |
(String pn) |
This method always returns true when invoked on an unnamed module. A package that is opened unconditionally is considered exported unconditionally at run-time and so this method returns true if the package is opened unconditionally.
This method does not check if the given module reads this module.
public boolean isOpen |
(String pn) |
This method always returns true when invoked on an unnamed module. Additionally, it always returns true when invoked on an open module with a package in the module.
This method does not check if the given module reads this module.
public Module addExports |
This method has no effect if the package is already exported (or open) to the given module.
public Module addOpens |
This method has no effect if the package is already open to the given module.
public Module addUses |
(Class<?> service) |
This method does not cause resolveAndBind to be re-run.
public boolean canUse |
(Class<?> service) |
() |
For named modules, the returned set contains an element for each package in the module.
For unnamed modules, the returned set contains an element for each package that has been defined in the unnamed module.
Note that any annotation returned by this method is a declaration annotation.
public Annotation[] getAnnotations |
() |
Note that any annotations returned by this method are declaration annotations.
public Annotation[] getDeclaredAnnotations |
() |
Note that any annotations returned by this method are declaration annotations.
public InputStream getResourceAsStream |
(String name) |
throws |
A resource in a named module may be encapsulated so that it cannot be located by code in other modules. Whether a resource can be located or not is determined as follows:
In the above, the package name for a resource is derived from the subsequence of characters that precedes the last '/' in the name and then replacing each '/' character in the subsequence with '.'. A leading slash is ignored when deriving the package name. As an example, the package name derived for a resource named "a/b/c/foo.properties" is "a.b.c". A resource name with the name "META-INF/MANIFEST.MF" is never encapsulated because "META-INF" is not a legal package name.
This method returns null if the resource is not in this module, the resource is encapsulated and cannot be located by the caller, or access to the resource is denied by the security manager.
public String toString |
() |
|
FlexDoc/Javadoc 2.0 Demo Java Doc |