Class ClassFileLocator.ForModule

    • Constructor Detail

      • ForModule

        protected ForModule​(JavaModule module)
        Creates a new class file locator for a Java module.
        Parameters:
        module - The represented Java module.
    • Method Detail

      • ofBootLayer

        public static ClassFileLocator ofBootLayer()
        Returns a class file locator that exposes all class files of the boot module layer. This class file locator is only available on virtual machines of version 9 or later. On earlier versions, the returned class file locator does not locate any resources.
        Returns:
        A class file locator that locates classes of the boot layer.
      • of

        public static ClassFileLocator of​(JavaModule module)
        Returns a class file locator for the provided module. If the provided module is not named, class files are located via this unnamed module's class loader.
        Parameters:
        module - The module to create a class file locator for.
        Returns:
        An appropriate class file locator.
      • locate

        public ClassFileLocator.Resolution locate​(String name)
                                           throws IOException
        Locates the class file for a given type and returns the binary data of the class file.
        Specified by:
        locate in interface ClassFileLocator
        Parameters:
        name - The name of the type to locate a class file representation for.
        Returns:
        Any binary representation of the type which might be illegal.
        Throws:
        IOException - If reading a class file causes an error.
      • locate

        protected static ClassFileLocator.Resolution locate​(JavaModule module,
                                                            String typeName)
                                                     throws IOException
        Creates a resolution for a Java module's class files.
        Parameters:
        module - The Java module to query.
        typeName - The name of the type being queried.
        Returns:
        A resolution for the query.
        Throws:
        IOException - If an I/O exception was thrown.