@HashCodeAndEqualsPlugin.Enhance public static class JavaModule.Dispatcher.Enabled extends java.lang.Object implements JavaModule.Dispatcher
java.lang.Module
API.JavaModule.Dispatcher.CreationAction, JavaModule.Dispatcher.Disabled, JavaModule.Dispatcher.Enabled
Modifier and Type | Field and Description |
---|---|
private java.lang.reflect.Method |
canRead
The
java.lang.Module#canRead(Module) method. |
private java.lang.reflect.Method |
getClassLoader
The
java.lang.Module#getClassLoader() method. |
private java.lang.reflect.Method |
getModule
The
java.lang.Class#getModule() method. |
private java.lang.reflect.Method |
getName
The
java.lang.Module#getName() method. |
private java.lang.reflect.Method |
getResourceAsStream
The
java.lang.Module#getResourceAsStream(String) method. |
private java.lang.reflect.Method |
isModifiableModule
The
java.lang.instrument.Instrumentation#isModifiableModule method. |
private java.lang.reflect.Method |
isNamed
The
java.lang.Module#isNamed() method. |
private static java.lang.Object[] |
NO_ARGUMENTS
An empty array that can be used to indicate no arguments to avoid an allocation on a reflective call.
|
private java.lang.reflect.Method |
redefineModule
The
java.lang.instrument.Instrumentation#redefineModule method. |
Modifier | Constructor and Description |
---|---|
protected |
Enabled(java.lang.reflect.Method getModule,
java.lang.reflect.Method getClassLoader,
java.lang.reflect.Method isNamed,
java.lang.reflect.Method getName,
java.lang.reflect.Method getResourceAsStream,
java.lang.reflect.Method canRead,
java.lang.reflect.Method isModifiableModule,
java.lang.reflect.Method redefineModule)
Creates an enabled dispatcher.
|
Modifier and Type | Method and Description |
---|---|
void |
addReads(java.lang.instrument.Instrumentation instrumentation,
java.lang.Object source,
java.lang.Object target)
Adds a read-edge from the source to the target module.
|
boolean |
canRead(java.lang.Object source,
java.lang.Object target)
Checks if the source module can read the target module.
|
java.lang.ClassLoader |
getClassLoader(java.lang.Object module)
Returns the module's class loader.
|
java.lang.String |
getName(java.lang.Object module)
Returns the module's name.
|
java.io.InputStream |
getResourceAsStream(java.lang.Object module,
java.lang.String name)
Returns a resource stream for this module for a resource of the given name or
null if such a resource does not exist. |
boolean |
isAlive()
Checks if this dispatcher is alive, i.e.
|
boolean |
isNamed(java.lang.Object module)
Returns
true if the supplied module is named. |
JavaModule |
moduleOf(java.lang.Class<?> type)
Extracts the Java
Module for the provided class or returns null if the current VM does not support modules. |
private static final java.lang.Object[] NO_ARGUMENTS
private final java.lang.reflect.Method getModule
java.lang.Class#getModule()
method.private final java.lang.reflect.Method getClassLoader
java.lang.Module#getClassLoader()
method.private final java.lang.reflect.Method isNamed
java.lang.Module#isNamed()
method.private final java.lang.reflect.Method getName
java.lang.Module#getName()
method.private final java.lang.reflect.Method getResourceAsStream
java.lang.Module#getResourceAsStream(String)
method.private final java.lang.reflect.Method canRead
java.lang.Module#canRead(Module)
method.private final java.lang.reflect.Method isModifiableModule
java.lang.instrument.Instrumentation#isModifiableModule
method.private final java.lang.reflect.Method redefineModule
java.lang.instrument.Instrumentation#redefineModule
method.protected Enabled(java.lang.reflect.Method getModule, java.lang.reflect.Method getClassLoader, java.lang.reflect.Method isNamed, java.lang.reflect.Method getName, java.lang.reflect.Method getResourceAsStream, java.lang.reflect.Method canRead, java.lang.reflect.Method isModifiableModule, java.lang.reflect.Method redefineModule)
getModule
- The java.lang.Class#getModule()
method.getClassLoader
- The java.lang.Module#getClassLoader()
method.isNamed
- The java.lang.Module#isNamed()
method.getName
- The java.lang.Module#getName()
method.getResourceAsStream
- The java.lang.Module#getResourceAsStream(String)
method.canRead
- The java.lang.Module#canRead(Module)
method.isModifiableModule
- The java.lang.instrument.Instrumentation#isModifiableModule
method.redefineModule
- The java.lang.instrument.Instrumentation#redefineModule
method.public boolean isAlive()
isAlive
in interface JavaModule.Dispatcher
true
if modules are supported on the current VM.public JavaModule moduleOf(java.lang.Class<?> type)
Module
for the provided class or returns null
if the current VM does not support modules.moduleOf
in interface JavaModule.Dispatcher
type
- The type for which to extract the module.Module
or null
if the current VM does not support modules.public java.io.InputStream getResourceAsStream(java.lang.Object module, java.lang.String name)
null
if such a resource does not exist.getResourceAsStream
in interface JavaModule.Dispatcher
module
- The java.lang.Module
instance to apply this method upon.name
- The name of the resource.null
if it does not exist.public java.lang.ClassLoader getClassLoader(java.lang.Object module)
getClassLoader
in interface JavaModule.Dispatcher
module
- The java.lang.Module
public boolean isNamed(java.lang.Object module)
true
if the supplied module is named.isNamed
in interface JavaModule.Dispatcher
module
- The java.lang.Module
to check for the existence of a name.true
if the supplied module is named.public java.lang.String getName(java.lang.Object module)
getName
in interface JavaModule.Dispatcher
module
- The java.lang.Module
to check for its name.public boolean canRead(java.lang.Object source, java.lang.Object target)
canRead
in interface JavaModule.Dispatcher
source
- The source module.target
- The target module.true
if the source module can read the target module.public void addReads(java.lang.instrument.Instrumentation instrumentation, java.lang.Object source, java.lang.Object target)
addReads
in interface JavaModule.Dispatcher
instrumentation
- The instrumentation instance to use for adding the edge.source
- The source module.target
- The target module.