public abstract class ModuleReference extends Object
A module reference is a concrete implementation of this class that
implements the abstract methods defined by this class. It contains the
module's descriptor and its location, if known. It also has the ability to
create a ModuleReader
in order to access the module's content, which
may be inside the Java run-time system itself or in an artifact such as a
modular JAR file.
ModuleFinder
,
ModuleReader
Modifier | Constructor | Description |
---|---|---|
protected |
ModuleReference(ModuleDescriptor descriptor,
URI location) |
Constructs a new instance of this class.
|
Modifier and Type | Method | Description |
---|---|---|
ModuleDescriptor |
descriptor() |
Returns the module descriptor.
|
Optional<URI> |
location() |
Returns the location of this module's content, if known.
|
abstract ModuleReader |
open() |
Opens the module content for reading.
|
protected ModuleReference(ModuleDescriptor descriptor, URI location)
descriptor
- The module descriptorlocation
- The module location or null
if not knownpublic final ModuleDescriptor descriptor()
public final Optional<URI> location()
This URI, when present, can be used as the location value of a CodeSource
so that a module's classes can be
granted specific permissions when loaded by a SecureClassLoader
.
Optional
if not knownpublic abstract ModuleReader open() throws IOException
ModuleReader
to read the moduleIOException
- If an I/O error occursSecurityException
- If denied by the security managerCopyright © 1993, 2017, Oracle and/or its affiliates · All rights reserved · License