Package org.pkl.core.module
Class ModuleKeys
- java.lang.Object
-
- org.pkl.core.module.ModuleKeys
-
public final class ModuleKeys extends java.lang.ObjectUtilities for creating and usingModuleKeys.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ModuleKeycached(ModuleKey delegate, java.lang.String text)Creates a module key that behaves likedelegate, except that it returnstextas its loaded source.static ModuleKeyclassPath(java.net.URI uri, java.lang.ClassLoader classLoader)Creates a module key for amodulepath:module to be resolved with the given class loader.static ModuleKeyfile(java.net.URI uri, java.nio.file.Path path)Creates a module key for afile:module.static ModuleKeygenericUrl(java.net.URI url)Creates a module key for the module with the given URL.static booleanisBaseModule(ModuleKey module)Tells if the given module is the standard library module with URIpkl:base.static booleanisStdLibModule(ModuleKey module)Tells if the given module is a standard library module.static ModuleKeymodulePath(java.net.URI uri, ModulePathResolver resolver)Creates a module key for amodulepath:module to be resolved with the given resolver.static ModuleKeypkg(java.net.URI uri)Creates a module key for the given package.static ModuleKeyprojectpackage(java.net.URI uri)static ModuleKeystandardLibrary(java.net.URI uri)Creates a module key for the standard library module with the given URI.static ModuleKeysynthetic(java.net.URI uri, java.lang.String sourceText)Creates a module key identified by the given URI and backed by the given source code.static ModuleKeysynthetic(java.net.URI uri, java.net.URI importBaseUri, java.net.URI resolvedUri, java.lang.String sourceText, boolean isCached)Creates a module key identified by the given URI and backed by the given source code.
-
-
-
Method Detail
-
isStdLibModule
public static boolean isStdLibModule(ModuleKey module)
Tells if the given module is a standard library module. Standard library modules ship with the language and have a URI of the formpkl:<simple module name>.
-
isBaseModule
public static boolean isBaseModule(ModuleKey module)
Tells if the given module is the standard library module with URIpkl:base.
-
synthetic
public static ModuleKey synthetic(java.net.URI uri, java.lang.String sourceText)
Creates a module key identified by the given URI and backed by the given source code. Shorthand forsynthetic(uri, uri, uri, sourceText, false.
-
synthetic
public static ModuleKey synthetic(java.net.URI uri, java.net.URI importBaseUri, java.net.URI resolvedUri, java.lang.String sourceText, boolean isCached)
Creates a module key identified by the given URI and backed by the given source code. Module imports will be resolved against the givenimportBaseUri. IfisCachedistrue, the resulting module will be cached withuriandresolvedUriused as cache keys.
-
standardLibrary
public static ModuleKey standardLibrary(java.net.URI uri)
Creates a module key for the standard library module with the given URI. The URI for a standard library module ispkl:<simple module name>. For example, the URI for the base library module ispkl:base.
-
file
public static ModuleKey file(java.net.URI uri, java.nio.file.Path path)
Creates a module key for afile:module.
-
modulePath
public static ModuleKey modulePath(java.net.URI uri, ModulePathResolver resolver)
Creates a module key for amodulepath:module to be resolved with the given resolver.
-
classPath
public static ModuleKey classPath(java.net.URI uri, java.lang.ClassLoader classLoader)
Creates a module key for amodulepath:module to be resolved with the given class loader.
-
genericUrl
public static ModuleKey genericUrl(java.net.URI url)
Creates a module key for the module with the given URL.
-
pkg
public static ModuleKey pkg(java.net.URI uri) throws java.net.URISyntaxException
Creates a module key for the given package.- Throws:
java.net.URISyntaxException
-
projectpackage
public static ModuleKey projectpackage(java.net.URI uri) throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
-
-