Class ConfigEvaluatorBuilder
ConfigEvaluators.-
Method Summary
Modifier and TypeMethodDescriptionaddEnvironmentVariable(String name, String value) Adds the given environment variable, overriding any environment variable previously added under the same name.addEnvironmentVariables(Map<String, String> envVars) Adds the given environment variables, overriding any environment variables previously added under the same name.addExternalProperties(Map<String, String> properties) Adds the given external properties, overriding any properties previously set under the same name.addExternalProperty(String name, String value) Adds the given external property, overriding any property previously set under the same name.applyFromProject(org.pkl.core.project.Project project) Sets the project for the evaluator, and applies any settings if set.build()Builds a config evaluator whose underlying module evaluator and value mapper is built using the configured builders.Returns the set of patterns to be allowed when importing modules.Returns the set of patterns to be allowed when reading resources.Returns the currently set environment variables.org.pkl.core.EvaluatorBuilderReturns the currently set module evaluator builder.Returns the currently set external properties.org.pkl.core.http.HttpClientReturns the currently set HTTP client.@Nullable PathReturns the currently set root directory, if set.@Nullable org.pkl.core.SecurityManagerReturns the currently set security manager.@Nullable org.pkl.core.StackFrameTransformerReturns the currently set stack frame transformer.@Nullable DurationReturns the currently set evaluation timeout.Returns the currently set value mapper builder.static ConfigEvaluatorBuilderCreates a builder with preconfigured module evaluator and value mapper builders.setAllowedModules(Collection<Pattern> patterns) Sets the set of URI patterns to be allowed when importing modules.setAllowedResources(Collection<Pattern> patterns) Sets the set of URI patterns to be allowed when reading resources.setEnvironmentVariables(Map<String, String> envVars) Removes any existing environment variables, then adds the given environment variables.setEvaluatorBuilder(org.pkl.core.EvaluatorBuilder evaluatorBuilder) Sets the underlying module evaluator builder.setExternalProperties(Map<String, String> properties) Removes any existing external properties, then adds the given properties.setHttpClient(org.pkl.core.http.HttpClient httpClient) Sets the HTTP Client to be used.setProjectDependencies(org.pkl.core.project.DeclaredDependencies dependencies) Sets the project for the evaluator, without applying evaluator settings in the project.setRootDir(@Nullable Path rootDir) Sets the root directory, which restricts access to file-based modules and resources located under this directory.setSecurityManager(org.pkl.core.SecurityManager manager) Sets the given security manager, replacing any previously set security manager.setStackFrameTransformer(org.pkl.core.StackFrameTransformer stackFrameTransformer) Sets the given stack frame transformer, replacing any previously set transformer.setTimeout(Duration timeout) Sets an evaluation timeout to be enforced by theConfigEvaluator'sevaluatemethods.setValueMapperBuilder(ValueMapperBuilder mapperBuilder) Sets the underlying value mapper builder.static ConfigEvaluatorBuilderCreates a builder with unconfigured module evaluator and value mapper builders.
-
Method Details
-
preconfigured
Creates a builder with preconfigured module evaluator and value mapper builders. -
unconfigured
Creates a builder with unconfigured module evaluator and value mapper builders. -
setEvaluatorBuilder
Sets the underlying module evaluator builder. When a config evaluator is built, the underlying module evaluator comes from this builder. -
getEvaluatorBuilder
public org.pkl.core.EvaluatorBuilder getEvaluatorBuilder()Returns the currently set module evaluator builder. -
setValueMapperBuilder
Sets the underlying value mapper builder. When a config evaluator is built, the underlying value mapper comes from this builder. -
getValueMapperBuilder
Returns the currently set value mapper builder. -
addEnvironmentVariable
Adds the given environment variable, overriding any environment variable previously added under the same name.Modules can read environment variables with
read("env:<NAME>").This is a convenience method that delegates to the underlying evaluator builder.
-
addEnvironmentVariables
Adds the given environment variables, overriding any environment variables previously added under the same name.Modules can read environment variables with
read("env:<NAME>").This is a convenience method that delegates to the underlying evaluator builder.
-
setEnvironmentVariables
Removes any existing environment variables, then adds the given environment variables.This is a convenience method that delegates to the underlying evaluator builder.
-
getEnvironmentVariables
Returns the currently set environment variables.This is a convenience method that delegates to the underlying evaluator builder.
-
addExternalProperty
Adds the given external property, overriding any property previously set under the same name.Modules can read external properties with
read("prop:<name>").This is a convenience method that delegates to the underlying evaluator builder.
-
addExternalProperties
Adds the given external properties, overriding any properties previously set under the same name.Modules can read external properties with
read("prop:<name>").This is a convenience method that delegates to the underlying evaluator builder.
-
setExternalProperties
Removes any existing external properties, then adds the given properties.This is a convenience method that delegates to the underlying evaluator builder.
-
getExternalProperties
Returns the currently set external properties.This is a convenience method that delegates to the underlying evaluator builder.
-
setSecurityManager
Sets the given security manager, replacing any previously set security manager.This is a convenience method that delegates to the underlying evaluator builder.
-
getSecurityManager
@Nullable public @Nullable org.pkl.core.SecurityManager getSecurityManager()Returns the currently set security manager.This is a convenience method that delegates to the underlying evaluator builder.
-
setStackFrameTransformer
public ConfigEvaluatorBuilder setStackFrameTransformer(org.pkl.core.StackFrameTransformer stackFrameTransformer) Sets the given stack frame transformer, replacing any previously set transformer.This is a convenience method that delegates to the underlying evaluator builder.
-
getStackFrameTransformer
@Nullable public @Nullable org.pkl.core.StackFrameTransformer getStackFrameTransformer()Returns the currently set stack frame transformer.This is a convenience method that delegates to the underlying evaluator builder.
-
setProjectDependencies
public ConfigEvaluatorBuilder setProjectDependencies(org.pkl.core.project.DeclaredDependencies dependencies) Sets the project for the evaluator, without applying evaluator settings in the project.This is a convenience method that delegates to the underlying evaluator builder.
-
applyFromProject
Sets the project for the evaluator, and applies any settings if set.This is a convenience method that delegates to the underlying evaluator builder.
- Throws:
IllegalStateException- ifsetSecurityManager(SecurityManager)was also called.
-
setTimeout
Sets an evaluation timeout to be enforced by theConfigEvaluator'sevaluatemethods.This is a convenience method that delegates to the underlying evaluator builder.
-
getTimeout
Returns the currently set evaluation timeout.This is a convenience method that delegates to the underlying evaluator builder.
-
setAllowedModules
Sets the set of URI patterns to be allowed when importing modules.This is a convenience method that delegates to the underlying evaluator builder.
- Throws:
IllegalStateException- ifsetSecurityManager(SecurityManager)was also called.
-
getAllowedModules
Returns the set of patterns to be allowed when importing modules.This is a convenience method that delegates to the underlying evaluator builder.
-
setAllowedResources
Sets the set of URI patterns to be allowed when reading resources.This is a convenience method that delegates to the underlying evaluator builder.
- Throws:
IllegalStateException- ifsetSecurityManager(SecurityManager)was also called.
-
getAllowedResources
Returns the set of patterns to be allowed when reading resources.This is a convenience method that delegates to the underlying evaluator builder.
-
setRootDir
Sets the root directory, which restricts access to file-based modules and resources located under this directory.This is a convenience method that delegates to the underlying evaluator builder.
-
getRootDir
Returns the currently set root directory, if set.This is a convenience method that delegates to the underlying evaluator builder.
-
setHttpClient
Sets the HTTP Client to be used.Defaults to
HttpClient.builder().buildLazily().- Since:
- 0.29.0
-
getHttpClient
public org.pkl.core.http.HttpClient getHttpClient()Returns the currently set HTTP client.- Since:
- 0.29.0
-
build
Builds a config evaluator whose underlying module evaluator and value mapper is built using the configured builders. The same builder can be used to build multiple config evaluators.
-