Interface Configuration.Builder
- All Known Subinterfaces:
EmbeddedStorageConfigurationBuilder
- All Known Implementing Classes:
Configuration.Builder.Default
,EmbeddedStorageConfigurationBuilder.Default
- Enclosing interface:
- Configuration
public static interface Configuration.Builder
Builder for
Configuration
s.
Child-configurations can be built by either using child(String)
builders,
or with full-qualified keys, as described in Configuration
.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Configuration.Builder.Default
-
Method Summary
Modifier and Type Method Description Configuration
buildConfiguration()
Finishes the building and returns the resultingConfiguration
.Configuration.Builder
child(String key)
Creates a builder for a child configuration.default Configuration.Builder
child(String key, Consumer<Configuration.Builder> childBuilder)
Creates a child configuration.default Configuration.Builder
load(ConfigurationLoader loader, ConfigurationParser parser)
Loads values and child-configurations from the specified source into this builder.default <S> Configuration.Builder
map(ConfigurationMapper<S> mapper, S source)
Maps values and child-configurations from the specified source into this builder.Configuration.Builder
set(String key, String value)
Sets either a simple key-value pair (foo=bar) or an entry in a child-configuration (full.qualified.foo=bar).Configuration.Builder
setAll(XGettingCollection<KeyValue<String,String>> properties)
Sets many entries at once.Configuration.Builder
setAll(KeyValue<String,String>... properties)
Sets many entries at once.Configuration.Builder
valueMapperProvider(ConfigurationValueMapperProvider valueMapperProvider)
Sets theConfigurationValueMapperProvider
.
-
Method Details
-
map
Maps values and child-configurations from the specified source into this builder. This can be used to get values from one or more external resources.- Parameters:
mapper
- the mapper for the sourcesource
- the input source- Returns:
- this builder
- See Also:
ConfigurationMapper
-
load
Loads values and child-configurations from the specified source into this builder. This can be used to get values from one or more external resources.- Parameters:
loader
- the loader to retrieve the inputparser
- the parser to parse the input- Returns:
- this builder
- See Also:
ConfigurationLoader
,ConfigurationParser
-
valueMapperProvider
Sets theConfigurationValueMapperProvider
. Use this method to insert user-defined value mappers.- Parameters:
valueMapperProvider
- the new mapper provider- Returns:
- this builder
-
set
Sets either a simple key-value pair (foo=bar) or an entry in a child-configuration (full.qualified.foo=bar).- Parameters:
key
- simple or full-qualified key, cannot be empty ornull
value
- the value to set, cannot benull
- Returns:
- this builder
-
setAll
Sets many entries at once.- Parameters:
properties
- the key-value pairs- Returns:
- this builder
- See Also:
set(String, String)
-
setAll
Sets many entries at once.- Parameters:
properties
- the key-value pairs- Returns:
- this builder
- See Also:
set(String, String)
-
child
Creates a builder for a child configuration.- Parameters:
key
- the key for the child configuration- Returns:
- a new builder
- See Also:
child(String, Consumer)
-
child
Creates a child configuration.- Parameters:
key
- the key for the child configurationchildBuilder
- the builder consumer for method chaining- Returns:
- this builder
-
buildConfiguration
Configuration buildConfiguration()Finishes the building and returns the resultingConfiguration
.- Returns:
- the
Configuration
with all values and child-configurations from this builder
-