public static class JavaModule.Dispatcher.Enabled extends Object implements JavaModule.Dispatcher
java.lang.reflect.Module
API.JavaModule.Dispatcher.Disabled, JavaModule.Dispatcher.Enabled
Modifier | Constructor and Description |
---|---|
protected |
Enabled(Method getModule,
Method getClassLoader,
Method isNamed,
Method getName,
Method canRead,
Method addModuleReads)
Creates an enabled dispatcher.
|
Modifier and Type | Method and Description |
---|---|
void |
addReads(Instrumentation instrumentation,
Object source,
Object target)
Adds a read-edge from the source to the target module.
|
boolean |
canRead(Object source,
Object target)
Checks if the source module can read the target module.
|
boolean |
equals(Object object) |
ClassLoader |
getClassLoader(Object module)
Returns the module's class loader.
|
String |
getName(Object module)
Returns the module's name.
|
int |
hashCode() |
boolean |
isAlive()
Checks if this dispatcher is alive, i.e. supports modules.
|
boolean |
isNamed(Object module)
Returns
true if the supplied module is named. |
JavaModule |
moduleOf(Class<?> type)
Extracts the Java
Module for the provided class or returns null if the current VM does not support modules. |
String |
toString() |
protected Enabled(Method getModule, Method getClassLoader, Method isNamed, Method getName, Method canRead, Method addModuleReads)
getModule
- The java.lang.Class#getModule()
method.getClassLoader
- The java.lang.reflect.Module#getClassLoader()
method.isNamed
- The java.lang.reflect.Module#isNamed()
method.getName
- The java.lang.reflect.Module#getName()
method.canRead
- The java.lang.reflect.Module#canRead(Module)
method.addModuleReads
- The java.lang.instrument.Instrumentation#addModuleReads(Module, Module)
method.public boolean isAlive()
JavaModule.Dispatcher
isAlive
in interface JavaModule.Dispatcher
true
if modules are supported on the current VM.public JavaModule moduleOf(Class<?> type)
JavaModule.Dispatcher
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 ClassLoader getClassLoader(Object module)
JavaModule.Dispatcher
getClassLoader
in interface JavaModule.Dispatcher
module
- The java.lang.reflect.Module
public boolean isNamed(Object module)
JavaModule.Dispatcher
true
if the supplied module is named.isNamed
in interface JavaModule.Dispatcher
module
- The java.lang.reflect.Module
to check for the existence of a name.true
if the supplied module is named.public String getName(Object module)
JavaModule.Dispatcher
getName
in interface JavaModule.Dispatcher
module
- The java.lang.reflect.Module
to check for its name.public boolean canRead(Object source, Object target)
JavaModule.Dispatcher
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(Instrumentation instrumentation, Object source, Object target)
JavaModule.Dispatcher
addReads
in interface JavaModule.Dispatcher
instrumentation
- The instrumentation instance to use for adding the edge.source
- The source module.target
- The target module.Copyright © 2014–2016. All rights reserved.