Class LayerFactory


  • public class LayerFactory
    extends Object
    Factory class allowing a JVMTI Java agent to define a Jigsaw Module Layer containing a Jigsaw module for the agent to populate with classes provided as byte arrays in class file format
    • Constructor Detail

      • LayerFactory

        public LayerFactory()
    • Method Detail

      • installModule

        public static Module installModule​(String moduleName,
                                           String[] exportsNames,
                                           String[] requiresNames,
                                           java.util.function.Function<String,​byte[]> classMapper)
        Create a module Layer above the boot Layer and install a module into it returning a classloader which can be used to drive installation of classes into the module. The class laoder does not install classes from a jar file located on disk. Instead the caller supplies a class mapper which is used to map class names which appear as Strings in the format "x/y/z/MyClass.class" to a corresponding class file format byte array.
        Parameters:
        moduleName - the name of the one module to be installed in the layer
        exportsNames - an array of names of packages to be exported by the module
        requiresNames - an array of names of modules to be imported by the module
        classMapper - a mapper provided by the caller to populate the module with classes which accepts a class name and returns the corresponding class file format byte array. The name will be presented in the format "x/y/z/MyClass.class".
        Returns:
        the module classloader.