public class JavaModule extends Object implements NamedElement.WithOptionalName, PrivilegedAction<ClassLoader>
java.lang.reflect.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.Dispatcher
A dispatcher for accessing the
java.lang.reflect.Module API if it is available on the current VM. |
NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeName| Modifier and Type | Field and Description |
|---|---|
static JavaModule |
UNSUPPORTED
Canonical 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(Object module)
Creates a new Java module representation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addReads(Instrumentation instrumentation,
JavaModule module)
Adds a read-edge to this module to the supplied module using the instrumentation API.
|
boolean |
canRead(JavaModule module)
Checks if this module can read the exported packages of the supplied module.
|
boolean |
equals(Object object) |
String |
getActualName()
Returns the name of this element as it is found in the source code.
|
ClassLoader |
getClassLoader(AccessControlContext accessControlContext)
Returns the class loader of this module.
|
int |
hashCode() |
boolean |
isNamed()
Returns
true if this element has an explicit name. |
static boolean |
isSupported()
Checks if the current VM supports the
java.lang.reflect.Module API. |
static JavaModule |
of(Object module)
Represents the supplied
java.lang.reflect.Module as an instance of this class and validates that the
supplied instance really represents a Java Module. |
static JavaModule |
ofType(Class<?> type)
Returns a representation of the supplied type's
java.lang.reflect.Module or null if the current VM does not support modules. |
ClassLoader |
run() |
String |
toString() |
Object |
unwrap()
Unwraps this instance to a
java.lang.reflect.Module. |
public static final JavaModule UNSUPPORTED
protected JavaModule(Object module)
module - The java.lang.reflect.Module instance this wrapper represents.public static JavaModule ofType(Class<?> type)
java.lang.reflect.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.reflect.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.reflect.Module API.true if the current VM supports modules.public boolean isNamed()
NamedElement.WithOptionalNametrue if this element has an explicit name.isNamed in interface NamedElement.WithOptionalNametrue if this element has an explicit name.public String getActualName()
NamedElementgetActualName in interface NamedElementpublic ClassLoader getClassLoader(AccessControlContext accessControlContext)
accessControlContext - The access control context to use for using extracting the class loader.public Object unwrap()
java.lang.reflect.Module.java.lang.reflect.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 void addReads(Instrumentation instrumentation, JavaModule module)
instrumentation - The instrumentation instance to use for adding the edge.module - The module to add as a read dependency to this module.public ClassLoader run()
run in interface PrivilegedAction<ClassLoader>Copyright © 2014–2016. All rights reserved.