Package net.bytebuddy.utility
Interface JavaModule.Dispatcher
-
- All Known Implementing Classes:
JavaModule.Dispatcher.Disabled,JavaModule.Dispatcher.Enabled
- Enclosing class:
- JavaModule
protected static interface JavaModule.DispatcherA dispatcher for accessing thejava.lang.ModuleAPI if it is available on the current VM.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classJavaModule.Dispatcher.CreationActionA creation action for a dispatcher.static classJavaModule.Dispatcher.DisabledA disabled dispatcher for a VM that does not support thejava.lang.ModuleAPI.static classJavaModule.Dispatcher.EnabledA dispatcher for a VM that does support thejava.lang.ModuleAPI.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddReads(java.lang.instrument.Instrumentation instrumentation, java.lang.Object source, java.lang.Object target)Adds a read-edge from the source to the target module.booleancanRead(java.lang.Object source, java.lang.Object target)Checks if the source module can read the target module.java.lang.ClassLoadergetClassLoader(java.lang.Object module)Returns the module's class loader.java.lang.StringgetName(java.lang.Object module)Returns the module's name.java.io.InputStreamgetResourceAsStream(java.lang.Object module, java.lang.String name)Returns a resource stream for this module for a resource of the given name ornullif such a resource does not exist.booleanisAlive()Checks if this dispatcher is alive, i.e.booleanisNamed(java.lang.Object module)Returnstrueif the supplied module is named.JavaModulemoduleOf(java.lang.Class<?> type)Extracts the JavaModulefor the provided class or returnsnullif the current VM does not support modules.
-
-
-
Method Detail
-
isAlive
boolean isAlive()
Checks if this dispatcher is alive, i.e. supports modules.- Returns:
trueif modules are supported on the current VM.
-
moduleOf
JavaModule moduleOf(java.lang.Class<?> type)
Extracts the JavaModulefor the provided class or returnsnullif the current VM does not support modules.- Parameters:
type- The type for which to extract the module.- Returns:
- The class's
Moduleornullif the current VM does not support modules.
-
isNamed
boolean isNamed(java.lang.Object module)
Returnstrueif the supplied module is named.- Parameters:
module- Thejava.lang.Moduleto check for the existence of a name.- Returns:
trueif the supplied module is named.
-
getName
java.lang.String getName(java.lang.Object module)
Returns the module's name.- Parameters:
module- Thejava.lang.Moduleto check for its name.- Returns:
- The module's (implicit or explicit) name.
-
getResourceAsStream
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 ornullif such a resource does not exist.- Parameters:
module- Thejava.lang.Moduleinstance to apply this method upon.name- The name of the resource.- Returns:
- An input stream for the resource or
nullif it does not exist.
-
getClassLoader
java.lang.ClassLoader getClassLoader(java.lang.Object module)
Returns the module's class loader.- Parameters:
module- Thejava.lang.Module- Returns:
- The module's class loader.
-
canRead
boolean canRead(java.lang.Object source, java.lang.Object target)Checks if the source module can read the target module.- Parameters:
source- The source module.target- The target module.- Returns:
trueif the source module can read the target module.
-
addReads
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.- Parameters:
instrumentation- The instrumentation instance to use for adding the edge.source- The source module.target- The target module.
-
-