Package io.quarkus.runtime.configuration
Class ConfigUtils
- java.lang.Object
-
- io.quarkus.runtime.configuration.ConfigUtils
-
public final class ConfigUtils extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ConfigUtils.BuildTimeDotEnvConfigSourceProvider
Same as BuildTimeEnvConfigSource.(package private) static class
ConfigUtils.BuildTimeEnvConfigSource
We override the EnvConfigSource, because we don't want the nothing back from getPropertiesNames at build time.(package private) static class
ConfigUtils.BuildTimeSysPropConfigSource
We only want to include properties in the quarkus namespace.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addMapping(io.smallrye.config.SmallRyeConfigBuilder builder, String mappingClass, String prefix)
static void
addSourceFactoryProvider(io.smallrye.config.SmallRyeConfigBuilder builder, ConfigSourceFactoryProvider provider)
static void
addSourceProvider(io.smallrye.config.SmallRyeConfigBuilder builder, org.eclipse.microprofile.config.spi.ConfigSourceProvider provider)
Add a configuration source provider to the builder.static void
addSourceProviders(io.smallrye.config.SmallRyeConfigBuilder builder, Collection<org.eclipse.microprofile.config.spi.ConfigSourceProvider> providers)
Add a configuration source providers to the builder.static io.smallrye.config.SmallRyeConfigBuilder
configBuilder(boolean runTime, boolean bootstrap, boolean addDiscovered, LaunchMode launchMode)
Get the basic configuration builder.static io.smallrye.config.SmallRyeConfigBuilder
configBuilder(boolean runTime, boolean addDiscovered, LaunchMode launchMode)
Get the basic configuration builder.static io.smallrye.config.SmallRyeConfigBuilder
configBuilder(boolean runTime, LaunchMode launchMode)
static io.smallrye.config.SmallRyeConfigBuilder
emptyConfigBuilder()
static boolean
isPropertyPresent(String propertyName)
Checks if a property is present in the current Configuration.static <T> IntFunction<List<T>>
listFactory()
static <T> IntFunction<Set<T>>
setFactory()
static <T> IntFunction<SortedSet<T>>
sortedSetFactory()
-
-
-
Field Detail
-
UUID_KEY
static final String UUID_KEY
The name of the property associated with a random UUID generated at launch time.- See Also:
- Constant Field Values
-
-
Method Detail
-
listFactory
public static <T> IntFunction<List<T>> listFactory()
-
setFactory
public static <T> IntFunction<Set<T>> setFactory()
-
sortedSetFactory
public static <T> IntFunction<SortedSet<T>> sortedSetFactory()
-
configBuilder
public static io.smallrye.config.SmallRyeConfigBuilder configBuilder(boolean runTime, LaunchMode launchMode)
-
configBuilder
public static io.smallrye.config.SmallRyeConfigBuilder configBuilder(boolean runTime, boolean addDiscovered, LaunchMode launchMode)
Get the basic configuration builder.- Parameters:
runTime
-true
if the configuration is run time,false
if build timeaddDiscovered
-true
if the ConfigSource and Converter objects should be auto-discovered- Returns:
- the configuration builder
-
configBuilder
public static io.smallrye.config.SmallRyeConfigBuilder configBuilder(boolean runTime, boolean bootstrap, boolean addDiscovered, LaunchMode launchMode)
Get the basic configuration builder.- Parameters:
runTime
-true
if the configuration is run time,false
if build timeaddDiscovered
-true
if the ConfigSource and Converter objects should be auto-discovered- Returns:
- the configuration builder
-
emptyConfigBuilder
public static io.smallrye.config.SmallRyeConfigBuilder emptyConfigBuilder()
-
addSourceProvider
public static void addSourceProvider(io.smallrye.config.SmallRyeConfigBuilder builder, org.eclipse.microprofile.config.spi.ConfigSourceProvider provider)
Add a configuration source provider to the builder.- Parameters:
builder
- the builderprovider
- the provider to add
-
addSourceProviders
public static void addSourceProviders(io.smallrye.config.SmallRyeConfigBuilder builder, Collection<org.eclipse.microprofile.config.spi.ConfigSourceProvider> providers)
Add a configuration source providers to the builder.- Parameters:
builder
- the builderproviders
- the providers to add
-
addSourceFactoryProvider
public static void addSourceFactoryProvider(io.smallrye.config.SmallRyeConfigBuilder builder, ConfigSourceFactoryProvider provider)
-
addMapping
public static void addMapping(io.smallrye.config.SmallRyeConfigBuilder builder, String mappingClass, String prefix)
-
isPropertyPresent
public static boolean isPropertyPresent(String propertyName)
Checks if a property is present in the current Configuration. Because the sources may not expose the property directly inConfigSource.getPropertyNames()
, we cannot reliable determine if the property is present in the properties list. The property needs to be retrieved to make sure it exists. Also, if the value is an expression, we want to ignore expansion, because this is not relevant for the check and the expansion value may not be available at this point. It may be interesting to expose such API in SmallRyeConfig directly.- Parameters:
propertyName
- the property name.- Returns:
- true if the property is present or false otherwise.
-
-