Package net.bytebuddy.utility
Enum JavaModule.Dispatcher.Disabled
- java.lang.Object
-
- java.lang.Enum<JavaModule.Dispatcher.Disabled>
-
- net.bytebuddy.utility.JavaModule.Dispatcher.Disabled
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<JavaModule.Dispatcher.Disabled>
,JavaModule.Dispatcher
- Enclosing interface:
- JavaModule.Dispatcher
public static enum JavaModule.Dispatcher.Disabled extends java.lang.Enum<JavaModule.Dispatcher.Disabled> implements JavaModule.Dispatcher
A disabled dispatcher for a VM that does not support thejava.lang.Module
API.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.utility.JavaModule.Dispatcher
JavaModule.Dispatcher.CreationAction, JavaModule.Dispatcher.Disabled, JavaModule.Dispatcher.Enabled
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
The singleton instance.
-
Constructor Summary
Constructors Modifier Constructor Description private
Disabled()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 ornull
if such a resource does not exist.boolean
isAlive()
Checks if this dispatcher is alive, i.e.boolean
isExported(java.lang.Object source, java.lang.Object target, java.lang.String aPackage)
Returnstrue
if the source module exports the supplied package to the target module.boolean
isNamed(java.lang.Object module)
Returnstrue
if the supplied module is named.boolean
isOpened(java.lang.Object source, java.lang.Object target, java.lang.String aPackage)
Returnstrue
if the source module opens the supplied package to the target module.void
modify(java.lang.instrument.Instrumentation instrumentation, java.lang.Object module, java.util.Set<java.lang.Object> reads, java.util.Map<java.lang.String,java.util.Set<java.lang.Object>> exports, java.util.Map<java.lang.String,java.util.Set<java.lang.Object>> opens, java.util.Set<java.lang.Class<?>> uses, java.util.Map<java.lang.Class<?>,java.util.List<java.lang.Class<?>>> provides)
Modifies this module's properties.JavaModule
moduleOf(java.lang.Class<?> type)
Extracts the JavaModule
for the provided class or returnsnull
if the current VM does not support modules.static JavaModule.Dispatcher.Disabled
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static JavaModule.Dispatcher.Disabled[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final JavaModule.Dispatcher.Disabled INSTANCE
The singleton instance.
-
-
Method Detail
-
values
public static JavaModule.Dispatcher.Disabled[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (JavaModule.Dispatcher.Disabled c : JavaModule.Dispatcher.Disabled.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static JavaModule.Dispatcher.Disabled valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
isAlive
public boolean isAlive()
Checks if this dispatcher is alive, i.e. supports modules.- Specified by:
isAlive
in interfaceJavaModule.Dispatcher
- Returns:
true
if modules are supported on the current VM.
-
moduleOf
public JavaModule moduleOf(java.lang.Class<?> type)
Extracts the JavaModule
for the provided class or returnsnull
if the current VM does not support modules.- Specified by:
moduleOf
in interfaceJavaModule.Dispatcher
- Parameters:
type
- The type for which to extract the module.- Returns:
- The class's
Module
ornull
if the current VM does not support modules.
-
getClassLoader
public java.lang.ClassLoader getClassLoader(java.lang.Object module)
Returns the module's class loader.- Specified by:
getClassLoader
in interfaceJavaModule.Dispatcher
- Parameters:
module
- Thejava.lang.Module
- Returns:
- The module's class loader.
-
isNamed
public boolean isNamed(java.lang.Object module)
Returnstrue
if the supplied module is named.- Specified by:
isNamed
in interfaceJavaModule.Dispatcher
- Parameters:
module
- Thejava.lang.Module
to check for the existence of a name.- Returns:
true
if the supplied module is named.
-
getName
public java.lang.String getName(java.lang.Object module)
Returns the module's name.- Specified by:
getName
in interfaceJavaModule.Dispatcher
- Parameters:
module
- Thejava.lang.Module
to check for its name.- Returns:
- The module's (implicit or explicit) name.
-
getResourceAsStream
public 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 ornull
if such a resource does not exist.- Specified by:
getResourceAsStream
in interfaceJavaModule.Dispatcher
- Parameters:
module
- Thejava.lang.Module
instance to apply this method upon.name
- The name of the resource.- Returns:
- An input stream for the resource or
null
if it does not exist.
-
isExported
public boolean isExported(java.lang.Object source, java.lang.Object target, java.lang.String aPackage)
Returnstrue
if the source module exports the supplied package to the target module.- Specified by:
isExported
in interfaceJavaModule.Dispatcher
- Parameters:
source
- The source module.target
- The target module.aPackage
- The name of the package to check.- Returns:
true
if the source module exports the supplied package to the target module.
-
isOpened
public boolean isOpened(java.lang.Object source, java.lang.Object target, java.lang.String aPackage)
Returnstrue
if the source module opens the supplied package to the target module.- Specified by:
isOpened
in interfaceJavaModule.Dispatcher
- Parameters:
source
- The source module.target
- The target module.aPackage
- The name of the package to check.- Returns:
true
if the source module opens the supplied package to the target module.
-
canRead
public boolean canRead(java.lang.Object source, java.lang.Object target)
Checks if the source module can read the target module.- Specified by:
canRead
in interfaceJavaModule.Dispatcher
- Parameters:
source
- The source module.target
- The target module.- Returns:
true
if the source module can read the target module.
-
modify
public void modify(java.lang.instrument.Instrumentation instrumentation, java.lang.Object module, java.util.Set<java.lang.Object> reads, java.util.Map<java.lang.String,java.util.Set<java.lang.Object>> exports, java.util.Map<java.lang.String,java.util.Set<java.lang.Object>> opens, java.util.Set<java.lang.Class<?>> uses, java.util.Map<java.lang.Class<?>,java.util.List<java.lang.Class<?>>> provides)
Modifies this module's properties.- Specified by:
modify
in interfaceJavaModule.Dispatcher
- Parameters:
instrumentation
- The instrumentation instace to use for applying the modification.module
- The module to modify.reads
- A set of additional modules this module should read.exports
- A map of packages to export to a set of modules.opens
- A map of packages to open to a set of modules.uses
- A set of provider interfaces to use by this module.provides
- A map of provider interfaces to provide by this module mapped to the provider implementations.
-
-