Enum JavaModule.Dispatcher.Disabled

    • 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​(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:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • isAlive

        public boolean isAlive()
        Checks if this dispatcher is alive, i.e. supports modules.
        Specified by:
        isAlive in interface JavaModule.Dispatcher
        Returns:
        true if modules are supported on the current VM.
      • moduleOf

        public JavaModule moduleOf​(Class<?> type)
        Extracts the Java Module for the provided class or returns null if the current VM does not support modules.
        Specified by:
        moduleOf in interface JavaModule.Dispatcher
        Parameters:
        type - The type for which to extract the module.
        Returns:
        The class's Module or null if the current VM does not support modules.
      • isNamed

        public boolean isNamed​(Object module)
        Returns true if the supplied module is named.
        Specified by:
        isNamed in interface JavaModule.Dispatcher
        Parameters:
        module - The java.lang.Module to check for the existence of a name.
        Returns:
        true if the supplied module is named.
      • getName

        public String getName​(Object module)
        Returns the module's name.
        Specified by:
        getName in interface JavaModule.Dispatcher
        Parameters:
        module - The java.lang.Module to check for its name.
        Returns:
        The module's (implicit or explicit) name.
      • getResourceAsStream

        public InputStream getResourceAsStream​(Object module,
                                               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.
        Specified by:
        getResourceAsStream in interface JavaModule.Dispatcher
        Parameters:
        module - The java.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​(Object source,
                                  Object target,
                                  String aPackage)
        Returns true if the source module exports the supplied package to the target module.
        Specified by:
        isExported in interface JavaModule.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​(Object source,
                                Object target,
                                String aPackage)
        Returns true if the source module opens the supplied package to the target module.
        Specified by:
        isOpened in interface JavaModule.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​(Object source,
                               Object target)
        Checks if the source module can read the target module.
        Specified by:
        canRead in interface JavaModule.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​(Instrumentation instrumentation,
                           Object module,
                           Set<Object> reads,
                           Map<String,​Set<Object>> exports,
                           Map<String,​Set<Object>> opens,
                           Set<Class<?>> uses,
                           Map<Class<?>,​List<Class<?>>> provides)
        Modifies this module's properties.
        Specified by:
        modify in interface JavaModule.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.