public class JavaModule extends Object implements NamedElement.WithOptionalName, AnnotationSource
java.lang.Module. On platforms that do not support the module API, modules are represented by null.| Modifier and Type | Class and Description | 
|---|---|
| protected static interface  | JavaModule.ModuleA proxy for interacting with  java.lang.Module. | 
| protected static interface  | JavaModule.ResolverA proxy for resolving a  Class'sjava.lang.Module. | 
NamedElement.WithDescriptor, NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeNameAnnotationSource.Empty, AnnotationSource.Explicit| Modifier and Type | Field and Description | 
|---|---|
| protected static JavaModule.Module | MODULEA dispatcher to interact with  java.lang.Module. | 
| protected static JavaModule.Resolver | RESOLVERA dispatcher to resolve a  Class'sjava.lang.Module. | 
| static JavaModule | UNSUPPORTEDCanonical representation of a Java module on a JVM that does not support the module API. | 
EMPTY_NAME, NO_NAME| Modifier | Constructor and Description | 
|---|---|
| protected  | JavaModule(AnnotatedElement module)Creates a new Java module representation. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | canRead(JavaModule module)Checks if this module can read the exported packages of the supplied module. | 
| boolean | equals(Object other) | 
| String | getActualName()Returns the display name of this element as it is found in the source code. | 
| ClassLoader | getClassLoader()Returns the class loader of this module. | 
| AnnotationList | getDeclaredAnnotations()Returns a list of annotations that are declared by this instance. | 
| Set<String> | getPackages()Returns the packages of this module. | 
| InputStream | getResourceAsStream(String name)Returns a resource stream for this module for a resource of the given name or  nullif such a resource does not exist. | 
| int | hashCode() | 
| boolean | isExported(PackageDescription packageDescription,
          JavaModule module)Returns  trueif this module exports the supplied package to this module. | 
| boolean | isNamed()Returns  trueif this element has an explicit name. | 
| boolean | isOpened(PackageDescription packageDescription,
        JavaModule module)Returns  trueif this module opens the supplied package to this module. | 
| static boolean | isSupported()Checks if the current VM supports the  java.lang.ModuleAPI. | 
| static JavaModule | of(Object module)Represents the supplied  java.lang.Moduleas an instance of this class and validates that the
 supplied instance really represents a JavaModule. | 
| static JavaModule | ofType(Class<?> type)Returns a representation of the supplied type's  java.lang.Moduleornullif the current VM does not support modules. | 
| String | toString() | 
| Object | unwrap()Unwraps this instance to a  java.lang.Module. | 
@AlwaysNull public static final JavaModule UNSUPPORTED
protected static final JavaModule.Resolver RESOLVER
Class's java.lang.Module.protected static final JavaModule.Module MODULE
java.lang.Module.protected JavaModule(AnnotatedElement module)
module - The java.lang.Module instance this wrapper represents.@MaybeNull public static JavaModule ofType(Class<?> type)
java.lang.Module or null if the current VM does not support modules.type - The type for which to describe the module.null if the current VM does not support modules.public static JavaModule of(Object module)
java.lang.Module as an instance of this class and validates that the
 supplied instance really represents a Java Module.module - The module to represent.public static boolean isSupported()
java.lang.Module API.true if the current VM supports modules.public boolean isNamed()
true if this element has an explicit name.isNamed in interface NamedElement.WithOptionalNametrue if this element has an explicit name.public String getActualName()
getActualName in interface NamedElementpublic Set<String> getPackages()
@MaybeNull public InputStream getResourceAsStream(String name) throws IOException
null if such a resource does not exist.name - The name of the resource.null if it does not exist.IOException - If an I/O exception occurs.@MaybeNull public ClassLoader getClassLoader()
public Object unwrap()
java.lang.Module.java.lang.Module.public boolean canRead(JavaModule module)
module - The module to check for its readability by this module.true if this module can read the supplied module.public boolean isExported(@MaybeNull PackageDescription packageDescription, JavaModule module)
true if this module exports the supplied package to this module.packageDescription - The package to check formodule - The target module.true if this module exports the supplied package to this module.public boolean isOpened(@MaybeNull PackageDescription packageDescription, JavaModule module)
true if this module opens the supplied package to this module.packageDescription - The package to check for.module - The target module.true if this module opens the supplied package to this module.public AnnotationList getDeclaredAnnotations()
getDeclaredAnnotations in interface AnnotationSourcepublic boolean equals(@MaybeNull Object other)
Copyright © 2014–2023. All rights reserved.