public class SmallRyeConfigBuilder extends Object implements ConfigBuilder
Constructor and Description |
---|
SmallRyeConfigBuilder() |
Modifier and Type | Method and Description |
---|---|
ConfigBuilder |
addDefaultSources()
Add the default config sources appearing on the builder's classpath
including:
System properties
Environment properties
/META-INF/microprofile-config.properties
|
ConfigBuilder |
addDiscoveredConverters()
Add the converters to be loaded via service loader pattern
|
ConfigBuilder |
addDiscoveredSources()
Add the config sources appearing to be loaded via service loader pattern
|
Config |
build()
Build the
Config object. |
ConfigBuilder |
forClassLoader(ClassLoader classLoader)
Return the ConfigBuilder for a given classloader
|
protected Config |
newConfig(List<ConfigSource> sources,
Map<Type,Converter<?>> configConverters) |
<T> ConfigBuilder |
withConverter(Class<T> type,
int priority,
Converter<T> converter)
Add the specified
Converter for the given type. |
ConfigBuilder |
withConverters(Converter<?>[] converters)
Add the specified
Converter . |
ConfigBuilder |
withSources(ConfigSource... configSources)
Add the specified
ConfigSource . |
SmallRyeConfigBuilder |
withWrapper(UnaryOperator<ConfigSource> wrapper) |
public ConfigBuilder addDiscoveredSources()
ConfigBuilder
addDiscoveredSources
in interface ConfigBuilder
public ConfigBuilder addDiscoveredConverters()
ConfigBuilder
addDiscoveredConverters
in interface ConfigBuilder
public ConfigBuilder addDefaultSources()
ConfigBuilder
addDefaultSources
in interface ConfigBuilder
public ConfigBuilder forClassLoader(ClassLoader classLoader)
ConfigBuilder
forClassLoader
in interface ConfigBuilder
classLoader
- the specified classloaderpublic ConfigBuilder withSources(ConfigSource... configSources)
ConfigBuilder
ConfigSource
.withSources
in interface ConfigBuilder
configSources
- the config sourcespublic ConfigBuilder withConverters(Converter<?>[] converters)
ConfigBuilder
Converter
.
This method uses reflection to determine what type the converter is for.
When using lambda expressions for custom converters you should use
ConfigBuilder.withConverter(Class, int, Converter)
and pass the target type explicitly
as lambda expressions do not offer enough type information to the reflection API.withConverters
in interface ConfigBuilder
converters
- the converterspublic <T> ConfigBuilder withConverter(Class<T> type, int priority, Converter<T> converter)
ConfigBuilder
Converter
for the given type.
This method does not rely on reflection to determine what type the converter is for
therefore also lambda expressions can be used.withConverter
in interface ConfigBuilder
T
- the type to converttype
- the Class of type to convertpriority
- the priority of the converter (custom converters have a default priority of 100).converter
- the converter (can not be null
)public SmallRyeConfigBuilder withWrapper(UnaryOperator<ConfigSource> wrapper)
public Config build()
ConfigBuilder
Config
object.build
in interface ConfigBuilder
Copyright © 2020 JBoss by Red Hat. All rights reserved.