java.lang.Object
io.jstach.kiwi.kvs.KeyValuesSystem.Builder
- Enclosing interface:
KeyValuesSystem
A builder class for constructing instances of
KeyValuesSystem
with
customizable components such as environment, loaders, and media finders.
Note: By default, the ServiceLoader
is not enabled. If you wish to include
services discovered via the ServiceLoader
, you need to explicitly set it
using serviceLoader(ServiceLoader)
.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds and returns a newKeyValuesSystem
instance configured with the provided settings.environment
(KeyValuesEnvironment environment) Sets theKeyValuesEnvironment
to be used by theKeyValuesSystem
.Adds a filter to the filter chain.Adds aKeyValuesServiceProvider.KeyValuesLoaderFinder
to the list of loader finders.mediaFinder
(KeyValuesServiceProvider.KeyValuesMediaFinder mediaFinder) Adds aKeyValuesServiceProvider.KeyValuesMediaFinder
to the list of media finders.serviceLoader
(ServiceLoader<KeyValuesServiceProvider> serviceLoader) Sets theServiceLoader
for loadingKeyValuesServiceProvider
implementations.Uses the default service loader to load extensions.
-
Method Details
-
environment
Sets theKeyValuesEnvironment
to be used by theKeyValuesSystem
.- Parameters:
environment
- the environment to set- Returns:
- this builder instance
-
loadFinder
public KeyValuesSystem.Builder loadFinder(KeyValuesServiceProvider.KeyValuesLoaderFinder loadFinder) Adds aKeyValuesServiceProvider.KeyValuesLoaderFinder
to the list of loader finders.- Parameters:
loadFinder
- the loader finder to add- Returns:
- this builder instance
-
mediaFinder
public KeyValuesSystem.Builder mediaFinder(KeyValuesServiceProvider.KeyValuesMediaFinder mediaFinder) Adds aKeyValuesServiceProvider.KeyValuesMediaFinder
to the list of media finders.- Parameters:
mediaFinder
- the media finder to add- Returns:
- this builder instance
-
filter
Adds a filter to the filter chain.- Parameters:
filter
- the filter to add- Returns:
- this
- See Also:
-
serviceLoader
Sets theServiceLoader
for loadingKeyValuesServiceProvider
implementations. If this is set, the builder will include anyKeyValuesServiceProvider.KeyValuesLoaderFinder
andKeyValuesServiceProvider.KeyValuesMediaFinder
instances found via theServiceLoader
.Note: This is not enabled by default. You must explicitly set a service loader to include additional service-provided components.
- Parameters:
serviceLoader
- the service loader to set- Returns:
- this builder instance
-
useServiceLoader
Uses the default service loader to load extensions.- Returns:
- this.
-
build
Builds and returns a newKeyValuesSystem
instance configured with the provided settings. The composite loader and media finders will include those added through this builder and, if specified, those found via the service loader.- Returns:
- a new
KeyValuesSystem
instance
-