ModuleFinder that locates modules on the file system by searching
a sequence of directories or packaged modules. The ModuleFinder can be
created to work in either the run-time or link-time phases. In both cases it
locates modular JAR and exploded modules. When created for link-time then it
additionally locates modules in JMOD files. The ModuleFinder can also
optionally patch any modules that it locates with a ModulePatcher.
| Modifier and Type | Class and Description |
|---|---|
| private static class | ModulePath.
Patterns used to derive the module name from a JAR file name. |
| Modifier and Type | Field and Description |
|---|---|
| private static final Attributes. | |
| private final Map | |
| private final Path[] | |
| private final boolean | |
| private static final String | |
| private static final PerfCounter | |
| private int | |
| private final ModulePatcher | |
| private final Runtime. | |
| private static final PerfCounter | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static String | |
| private ModuleDescriptor | |
| private Set | |
| private String | |
| public Optional | find(String name)
Implements java. Finds a reference to a module of a given name. |
| public Set | findAll()
Implements java. Returns the set of all module references that this finder can locate. |
| private boolean | |
| private boolean | |
| private boolean | |
| private Set | |
| private Set | |
| private String | nextLine(BufferedReader reader)
Reads the next line from the given reader and trims it of comments and leading/trailing white space. |
| public static ModuleFinder | of(ModulePatcher patcher, Path... entries)
Returns a ModuleFinder that locates modules on the file system by searching a sequence of directories and/or packaged modules. |
| public static ModuleFinder | of(Path... entries)
Hides java. Returns a ModuleFinder that locates modules on the file system by searching a sequence of directories and/or packaged modules. |
| public static ModuleFinder | |
| private static String | |
| private ModuleReference | readExplodedModule(Path dir)
Returns a |
| private ModuleReference | |
| private ModuleReference | |
| private ModuleReference | readModule(Path entry, BasicFileAttributes attrs)
Reads a packaged or exploded module, returning a |
| private Map | |
| private Map | Returns: a map of module name to ModuleReference for the modules found in the directoryScans the given directory for packaged or exploded modules. |
| private void | |
| private Optional | |
| private Optional | toPackageName(Path file, String separator)
Maps the relative path of an entry in an exploded module to a package name. |
| private Optional | toServiceName(String cf)
Returns the service type corresponding to the name of a services configuration file if it is a legal type name. |
| AUTOMATIC_MODULE_NAME | back to summary |
|---|---|
| private static final Attributes. | |
| cachedModules | back to summary |
|---|---|
| private final Map<String, ModuleReference> cachedModules | |
| entries | back to summary |
|---|---|
| private final Path[] entries | |
| isLinkPhase | back to summary |
|---|---|
| private final boolean isLinkPhase | |
| MODULE_INFO | back to summary |
|---|---|
| private static final String MODULE_INFO | |
| moduleCount | back to summary |
|---|---|
| private static final PerfCounter moduleCount | |
| next | back to summary |
|---|---|
| private int next | |
| patcher | back to summary |
|---|---|
| private final ModulePatcher patcher | |
| releaseVersion | back to summary |
|---|---|
| private final Runtime. | |
| scanTime | back to summary |
|---|---|
| private static final PerfCounter scanTime | |
| SERVICES_PREFIX | back to summary |
|---|---|
| private static final String SERVICES_PREFIX | |
| ModulePath | back to summary |
|---|---|
| private ModulePath(Runtime. | |
| cleanModuleName | back to summary |
|---|---|
| private static String cleanModuleName(String mn) Clean up candidate module name derived from a JAR file name. | |
| deriveModuleDescriptor | back to summary |
|---|---|
| private ModuleDescriptor deriveModuleDescriptor(JarFile jf) throws IOException Treat the given JAR file as a module as follows: 1. The value of the Automatic-Module-Name attribute is the module name 2. The version, and the module name when the Automatic-Module-Name attribute is not present, is derived from the file ame of the JAR file 3. All packages are derived from the .class files in the JAR file 4. The contents of any META-INF/services configuration files are mapped to "provides" declarations 5. The Main-Class attribute in the main attributes of the JAR manifest is mapped to the module descriptor mainClass if possible | |
| explodedPackages | back to summary |
|---|---|
| private Set | |
| fileName | back to summary |
|---|---|
| private String fileName(ModuleReference mref) Returns a string with the file name of the module if possible. If the module location is not a file URI then return the URI as a string. | |
| find | back to summary |
|---|---|
| public Optional Implements java. Doc from java. Finds a reference to a module of a given name. A
| |
| findAll | back to summary |
|---|---|
| public Set Implements java. Doc from java. Returns the set of all module references that this finder can locate. A
| |
| hasNextEntry | back to summary |
|---|---|
| private boolean hasNextEntry() Returns | |
| isDefaultFileSystem | back to summary |
|---|---|
| private boolean isDefaultFileSystem(Path path) Return true if a path locates a path in the default file system | |
| isHidden | back to summary |
|---|---|
| private boolean isHidden(Path file) Returns true if the given file exists and is a hidden file | |
| jarPackages | back to summary |
|---|---|
| private Set | |
| jmodPackages | back to summary |
|---|---|
| private Set | |
| nextLine | back to summary |
|---|---|
| private String nextLine(BufferedReader reader) throws IOException Reads the next line from the given reader and trims it of comments and leading/trailing white space. Returns null if the reader is at EOF. | |
| of | back to summary |
|---|---|
| public static ModuleFinder of(ModulePatcher patcher, Path... entries) Returns a ModuleFinder that locates modules on the file system by searching a sequence of directories and/or packaged modules. The modules may be patched by the given ModulePatcher. | |
| of | back to summary |
|---|---|
| public static ModuleFinder of(Path... entries) Hides java. Returns a ModuleFinder that locates modules on the file system by searching a sequence of directories and/or packaged modules. | |
| of | back to summary |
|---|---|
| public static ModuleFinder of(Runtime. Returns a ModuleFinder that locates modules on the file system by searching a sequence of directories and/or packaged modules. | |
| packageName | back to summary |
|---|---|
| private static String packageName(String cn) Maps a type name to its package name. | |
| readExplodedModule | back to summary |
|---|---|
| private ModuleReference readExplodedModule(Path dir) throws IOException Returns a | |
| readJar | back to summary |
|---|---|
| private ModuleReference readJar(Path file) throws IOException Returns a | |
| readJMod | back to summary |
|---|---|
| private ModuleReference readJMod(Path file) throws IOException Returns a | |
| readModule | back to summary |
|---|---|
| private ModuleReference readModule(Path entry, BasicFileAttributes attrs) throws IOException Reads a packaged or exploded module, returning a
| |
| scan | back to summary |
|---|---|
| private Map Scan the given module path entry. If the entry is a directory then it is a directory of modules or an exploded module. If the entry is a regular file then it is assumed to be a packaged module.
| |
| scanDirectory | back to summary |
|---|---|
| private Map Scans the given directory for packaged or exploded modules.
| |
| scanNextEntry | back to summary |
|---|---|
| private void scanNextEntry() Scans the next entry on the module path. A no-op if all entries have already been scanned.
| |
| toPackageName | back to summary |
|---|---|
| private Optional Maps the name of an entry in a JAR or ZIP file to a package name.
| |
| toPackageName | back to summary |
|---|---|
| private Optional Maps the relative path of an entry in an exploded module to a package name.
| |
| toServiceName | back to summary |
|---|---|
| private Optional Returns the service type corresponding to the name of a services configuration file if it is a legal type name. For example, if called with "META-INF/services/p.S" then this method returns a container with the value "p.S". | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final Pattern | |
| pack-priv static final Pattern | |
| pack-priv static final Pattern | |
| pack-priv static final Pattern | |
| pack-priv static final Pattern |
| Access | Constructor and Description |
|---|---|
| private |
| DASH_VERSION | back to summary |
|---|---|
| pack-priv static final Pattern DASH_VERSION | |
| LEADING_DOTS | back to summary |
|---|---|
| pack-priv static final Pattern LEADING_DOTS | |
| NON_ALPHANUM | back to summary |
|---|---|
| pack-priv static final Pattern NON_ALPHANUM | |
| REPEATING_DOTS | back to summary |
|---|---|
| pack-priv static final Pattern REPEATING_DOTS | |
| TRAILING_DOTS | back to summary |
|---|---|
| pack-priv static final Pattern TRAILING_DOTS | |
| Patterns | back to summary |
|---|---|
| private Patterns() | |