Class ModuleRef

    • Constructor Detail

      • ModuleRef

        public ModuleRef​(Object moduleReference,
                         Object moduleLayer)
    • Method Detail

      • getModuleName

        public String getModuleName()
        Returns the module name, i.e. moduleReference.descriptor().name().
      • getModuleReference

        public Object getModuleReference()
        Returns the module reference (type ModuleReference).
      • getModuleLayer

        public Object getModuleLayer()
        Returns the module layer (type ModuleLayer).
      • getModuleDescriptor

        public Object getModuleDescriptor()
        Returns the module descriptor, i.e. moduleReference.descriptor() (type ModuleDescriptor).
      • getModulePackages

        public List<String> getModulePackages()
        Returns the list of packages in the module.
      • getModuleLocation

        public URI getModuleLocation()
        Returns the module location, i.e. moduleReference.location(). Returns null for modules that do not have a location.
      • isSystemModule

        public boolean isSystemModule()
        Returns true if this module's location is a non-"file:/" ("jrt:/") URI, or if it has no location URI, or if it uses the (null) bootstrap ClassLoader, or if the module name starts with a system prefix ("java.", "jre.", etc.).
      • getModuleLocationStr

        public String getModuleLocationStr()
        Returns the module location as a string, i.e. moduleReference.location().toString(). Returns null for modules that do not have a location.
      • getModuleLocationFile

        public File getModuleLocationFile()
        Returns the module location as a File, i.e. new File(moduleReference.location()). Returns null for modules that do not have a location, or for system ("jrt:/") modules.
      • getClassLoader

        public ClassLoader getClassLoader()
        Returns the classloader for the module, i.e. moduleLayer.findLoader(moduleReference.descriptor().name()).
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • findModuleRefs

        public static List<ModuleRef> findModuleRefs​(Class<?>[] callStack)
        Get all visible ModuleReferences in all layers, given an array of stack frame Class<?> references.