Package org.pkl.core.resource
Class ResourceReaders
- java.lang.Object
-
- org.pkl.core.resource.ResourceReaders
-
public final class ResourceReaders extends java.lang.ObjectPredefined resource readers for OS environment variables and external properties.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ResourceReaderclassPath(java.lang.ClassLoader classLoader)A resource reader for JVM class path resources.static ResourceReaderenvironmentVariable()A resource reader for OS environment variables.static ResourceReaderexternalProperty()A resource reader for external properties.static ResourceReaderfile()static java.util.List<ResourceReader>fromServiceProviders()Returns resource readers registered asservice providersof typeorg.pkl.core.resource.ResourceReader.static ResourceReaderhttp()A resource reader for HTTP resources.static ResourceReaderhttps()A resource reader for HTTPS resources.static ResourceReadermodulePath(ModulePathResolver resolver)A resource reader for Pkl module path (--module-path) resources.static ResourceReaderpkg()A resource reader forpackage:resources.static ResourceReaderprojectpackage()
-
-
-
Method Detail
-
environmentVariable
public static ResourceReader environmentVariable()
A resource reader for OS environment variables. If this resource reader is present, Pkl code can read environment variableFOO_BARwithread("env:FOO_BAR"), provided that resource URIenv:FOO_BARmatches an entry in the resource allowlist (--allowed-resources).
-
externalProperty
public static ResourceReader externalProperty()
A resource reader for external properties. If this resource reader is present, Pkl code can read external propertyfoo.barwithread("prop:foo.bar"), provided that resource URIprop:foo.barmatches an entry in the resource allowlist (--allowed-resources).
-
file
public static ResourceReader file()
-
http
public static ResourceReader http()
A resource reader for HTTP resources. If this resource reader is present, Pkl code can read HTTP resourcehttp://apple.com/foo/bar.txtwithread("http://apple.com/foo/bar.txt"), provided that resource URI"http://apple.com/foo/bar.txt"matches an entry in the resource allowlist (--allowed-resources).
-
https
public static ResourceReader https()
A resource reader for HTTPS resources. If this resource reader is present, Pkl code can read HTTPS resourcehttps://apple.com/foo/bar.txtwithread("https://apple.com/foo/bar.txt"), provided that resource URI"https://apple.com/foo/bar.txt"matches an entry in the resource allowlist (--allowed-resources).
-
classPath
public static ResourceReader classPath(java.lang.ClassLoader classLoader)
A resource reader for JVM class path resources. If this resource reader is present, Pkl code can read class path resource/foo/bar.txtwithread("modulepath:foo/bar.txt"), provided that resource URI"modulepath:foo/bar.txt"matches an entry in the resource allowlist (--allowed-resources).
-
modulePath
public static ResourceReader modulePath(ModulePathResolver resolver)
A resource reader for Pkl module path (--module-path) resources. If this resource reader is present, Pkl code can read module path resource/foo/bar.txtwithread("modulepath:foo/bar.txt"), provided that resource URI"modulepath:foo/bar.txt"matches an entry in the resource allowlist (--allowed-resources).
-
pkg
public static ResourceReader pkg()
A resource reader forpackage:resources. If this resource reader is present, Pkl code can read resources from within packages withread("package://example.com/foo@1.0.0#/foo.txt"), or using dependency notation withread("@foo/foo.txt")assuming that the Pkl module is within a project that declares a dependency namedfoo.
-
projectpackage
public static ResourceReader projectpackage()
-
fromServiceProviders
public static java.util.List<ResourceReader> fromServiceProviders()
Returns resource readers registered asservice providersof typeorg.pkl.core.resource.ResourceReader.
-
-