Class LayerFactory


  • public class LayerFactory
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      LayerFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Module installModule​(java.lang.String moduleName, java.lang.String[] exportsNames, java.lang.String[] requiresNames, java.util.function.Function<java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LayerFactory

        public LayerFactory()
    • Method Detail

      • installModule

        public static java.lang.Module installModule​(java.lang.String moduleName,
                                                     java.lang.String[] exportsNames,
                                                     java.lang.String[] requiresNames,
                                                     java.util.function.Function<java.lang.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.