Class ConfigBuilder
-
- All Implemented Interfaces:
public final class ConfigBuilder extends BaseConfigBuilder
A concrete implementation of the BaseConfigBuilder class. This class builds PolywrapClient instances using provided configurations.
-
-
Field Summary
Fields Modifier and Type Field Description private final BuilderConfigconfig
-
Constructor Summary
Constructors Constructor Description ConfigBuilder()
-
Method Summary
Modifier and Type Method Description final BuilderConfiggetConfig()Holds the current configuration being built. BaseConfigBuilderaddDefaults()Adds all default configuration Bundles to the current configuration. PolywrapClientbuild()Builds a PolywrapClient instance with the current builder configuration and optional additional configuration specified through a builder DSL. final BaseConfigBuilderaddBundle(NativeBundle bundle)Adds a NativeBundle from the FFI. final BaseConfigBuilderaddBundle(Bundle bundle)Adds a Bundle to the current configuration. final BaseConfigBuilderadd(BuilderConfig config)Adds the given BuilderConfig to the current configuration. final BaseConfigBuildersetWrapper(Pair<String, Wrapper> wrapper)Adds a wrapper with a specified URI key to the current configuration. final BaseConfigBuildersetWrappers(Map<String, Wrapper> wrappers)Adds a set of wrappers with specified URI keys to the current configuration. final BaseConfigBuilderremoveWrapper(String uri)Removes a wrapper with the specified URI key from the current configuration. final BaseConfigBuildersetPackage(Pair<String, WrapPackage> wrapPackage)Adds a package with a specified URI key to the current configuration. final BaseConfigBuildersetPackages(Map<String, WrapPackage> packages)Adds a set of packages with specified URI keys to the current configuration. final BaseConfigBuilderremovePackage(String uri)Removes a package with the specified URI key from the current configuration. final <E extends Any> BaseConfigBuilderaddEnv(Pair<String, E> env)Adds an environment variable with a specified URI key to the current configuration. final <E extends Any> BaseConfigBuilderaddEnvs(Map<String, E> envs)Adds a set of environment variables with specified URI keys to the current configuration. final BaseConfigBuilderremoveEnv(String uri)Removes an environment variable with the specified URI key from the current configuration. final <E extends Any> BaseConfigBuildersetEnv(Pair<String, E> env)Sets or replaces an environment variable with a specified URI key in the current configuration. final BaseConfigBuilderaddInterfaceImplementation(String interfaceUri, String implementationUri)Adds an interface implementation with the specified interface and implementation URIs. final BaseConfigBuilderaddInterfaceImplementations(String interfaceUri, List<String> implementationUris)Adds multiple interface implementations with the specified interface URI and a list of implementation URIs. final BaseConfigBuilderremoveInterfaceImplementation(String interfaceUri, String implementationUri)Removes an interface implementation with the specified interface and implementation URIs. final BaseConfigBuildersetRedirect(Pair<String, String> redirect)Adds a redirect with a specified source and destination URI. final BaseConfigBuildersetRedirects(Map<String, String> redirects)Adds a set of redirects with specified source and destination URIs. final BaseConfigBuilderremoveRedirect(String from)Removes a redirect with the specified source URI. final BaseConfigBuilderaddResolver(UriResolver resolver)Adds a UriResolver to the current configuration. final BaseConfigBuilderaddResolvers(List<UriResolver> resolvers)Adds a list of UriResolver instances to the current configuration. -
-
Method Detail
-
getConfig
final BuilderConfig getConfig()
Holds the current configuration being built.
-
addDefaults
BaseConfigBuilder addDefaults()
Adds all default configuration Bundles to the current configuration.
-
build
PolywrapClient build()
Builds a PolywrapClient instance with the current builder configuration and optional additional configuration specified through a builder DSL.
-
addBundle
final BaseConfigBuilder addBundle(NativeBundle bundle)
Adds a NativeBundle from the FFI. Bundles defined in the FFI are always added to the final configuration before all other items, and therefore can be overwritten regardless of the order in which they are added.
-
addBundle
final BaseConfigBuilder addBundle(Bundle bundle)
Adds a Bundle to the current configuration.
-
add
final BaseConfigBuilder add(BuilderConfig config)
Adds the given BuilderConfig to the current configuration.
- Parameters:
config- The BuilderConfig to add.
-
setWrapper
final BaseConfigBuilder setWrapper(Pair<String, Wrapper> wrapper)
Adds a wrapper with a specified URI key to the current configuration.
-
setWrappers
final BaseConfigBuilder setWrappers(Map<String, Wrapper> wrappers)
Adds a set of wrappers with specified URI keys to the current configuration.
-
removeWrapper
final BaseConfigBuilder removeWrapper(String uri)
Removes a wrapper with the specified URI key from the current configuration.
- Parameters:
uri- The URI key of the wrapper to remove.
-
setPackage
final BaseConfigBuilder setPackage(Pair<String, WrapPackage> wrapPackage)
Adds a package with a specified URI key to the current configuration.
- Parameters:
wrapPackage- A Pair of the URI key and the WrapPackage to add.
-
setPackages
final BaseConfigBuilder setPackages(Map<String, WrapPackage> packages)
Adds a set of packages with specified URI keys to the current configuration.
- Parameters:
packages- A Map of URI keys to WrapPackage instances to add.
-
removePackage
final BaseConfigBuilder removePackage(String uri)
Removes a package with the specified URI key from the current configuration.
- Parameters:
uri- The URI key of the package to remove.
-
addEnv
final <E extends Any> BaseConfigBuilder addEnv(Pair<String, E> env)
Adds an environment variable with a specified URI key to the current configuration.
- Parameters:
env- A Pair of the URI key and the WrapEnv or serializable Env class instance to add.
-
addEnvs
final <E extends Any> BaseConfigBuilder addEnvs(Map<String, E> envs)
Adds a set of environment variables with specified URI keys to the current configuration.
- Parameters:
envs- A Map of URI keys to WrapEnv or serializable Env class instances to add.
-
removeEnv
final BaseConfigBuilder removeEnv(String uri)
Removes an environment variable with the specified URI key from the current configuration.
- Parameters:
uri- The URI key of the environment variable to remove.
-
setEnv
final <E extends Any> BaseConfigBuilder setEnv(Pair<String, E> env)
Sets or replaces an environment variable with a specified URI key in the current configuration.
- Parameters:
env- A Pair of the URI key and the WrapEnv or serializable Env class instance to set.
-
addInterfaceImplementation
final BaseConfigBuilder addInterfaceImplementation(String interfaceUri, String implementationUri)
Adds an interface implementation with the specified interface and implementation URIs.
- Parameters:
interfaceUri- The URI of the interface to associate with the implementation.implementationUri- The URI of the implementation.
-
addInterfaceImplementations
final BaseConfigBuilder addInterfaceImplementations(String interfaceUri, List<String> implementationUris)
Adds multiple interface implementations with the specified interface URI and a list of implementation URIs.
- Parameters:
interfaceUri- The URI of the interface to associate with the implementations.implementationUris- A List of URIs of the implementations.
-
removeInterfaceImplementation
final BaseConfigBuilder removeInterfaceImplementation(String interfaceUri, String implementationUri)
Removes an interface implementation with the specified interface and implementation URIs.
- Parameters:
interfaceUri- The URI of the interface associated with the implementation.implementationUri- The URI of the implementation to remove.
-
setRedirect
final BaseConfigBuilder setRedirect(Pair<String, String> redirect)
Adds a redirect with a specified source and destination URI.
- Parameters:
redirect- A Pair of the source URI and the destination URI.
-
setRedirects
final BaseConfigBuilder setRedirects(Map<String, String> redirects)
Adds a set of redirects with specified source and destination URIs.
- Parameters:
redirects- A Map of source URIs to destination URIs.
-
removeRedirect
final BaseConfigBuilder removeRedirect(String from)
Removes a redirect with the specified source URI.
- Parameters:
from- The source URI of the redirect to remove.
-
addResolver
final BaseConfigBuilder addResolver(UriResolver resolver)
Adds a UriResolver to the current configuration.
- Parameters:
resolver- The UriResolver instance to add.
-
addResolvers
final BaseConfigBuilder addResolvers(List<UriResolver> resolvers)
Adds a list of UriResolver instances to the current configuration.
- Parameters:
resolvers- A List of UriResolver instances to add.
-
-
-
-