Interface JarModuleInfo
- All Known Implementing Classes:
AuomaticModuleJarModuleInfo, ModJarMetadata, ModuleJarModuleInfo
public interface JarModuleInfo
Describes the modular properties of a Jar file, with direct access to the module name and version,
as well as the ability to create a module descriptor for a given
JarContents, which may
involve scanning the Jar file for packages.-
Method Summary
Modifier and TypeMethodDescriptioncreateDescriptor(JarContents contents) static JarModuleInfofrom(JarContents jar) Builds the jar metadata for a jar following the normal rules for Java jars.name()static voidscanAutomaticModule(JarContents jar, ModuleDescriptor.Builder builder, String... excludedRootDirectories) Scans an automatic module for the following and applies them to the given module builder.Scans a given Jar for all packages that contain files for use withModuleDescriptor.read(InputStream, Supplier).version()
-
Method Details
-
name
String name() -
version
-
createDescriptor
-
from
Builds the jar metadata for a jar following the normal rules for Java jars.If the jar has a
module-info.classfile, the module info is read from there. Otherwise, the jar is an automatic module, whose name is optionally derived fromAutomatic-Module-Namein the manifest. -
scanAutomaticModule
static void scanAutomaticModule(JarContents jar, ModuleDescriptor.Builder builder, String... excludedRootDirectories) Scans an automatic module for the following and applies them to the given module builder.- Packages containing class files.
- Java
ServiceLoaderproviders found inMETA-INF/services/
- Parameters:
excludedRootDirectories- Allows for additional root directories to be completely ignored for scanning packages. Useful if it is known beforehand that certain subdirectories are unlikely to contain classes.
-
scanModulePackages
Scans a given Jar for all packages that contain files for use withModuleDescriptor.read(InputStream, Supplier).Unlike
scanAutomaticModule(JarContents, ModuleDescriptor.Builder, String...), this also finds packages that contain only resource files, which is consistent with the behavior ofModuleFinderfor modular Jar files.
-