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 classConfigUtils.BuildTimeDotEnvConfigSourceProviderSame as BuildTimeEnvConfigSource.(package private) static classConfigUtils.BuildTimeEnvConfigSourceWe override the EnvConfigSource, because we don't want the nothing back from getPropertiesNames at build time.(package private) static classConfigUtils.BuildTimeSysPropConfigSourceWe only want to include properties in the quarkus namespace.
-
Field Summary
Fields Modifier and Type Field Description static StringQUARKUS_RUNTIME_CONFIG_DEFAULTS_PROPERTIES(package private) static StringUUID_KEYThe name of the property associated with a random UUID generated at launch time.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddMapping(io.smallrye.config.SmallRyeConfigBuilder builder, String mappingClass, String prefix)static voidaddSourceFactoryProvider(io.smallrye.config.SmallRyeConfigBuilder builder, ConfigSourceFactoryProvider provider)static voidaddSourceProvider(io.smallrye.config.SmallRyeConfigBuilder builder, org.eclipse.microprofile.config.spi.ConfigSourceProvider provider)Add a configuration source provider to the builder.static voidaddSourceProviders(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.SmallRyeConfigBuilderconfigBuilder(boolean runTime, boolean bootstrap, boolean addDiscovered, LaunchMode launchMode)Get the basic configuration builder.static io.smallrye.config.SmallRyeConfigBuilderconfigBuilder(boolean runTime, boolean addDiscovered, LaunchMode launchMode)Get the basic configuration builder.static io.smallrye.config.SmallRyeConfigBuilderconfigBuilder(boolean runTime, LaunchMode launchMode)static io.smallrye.config.SmallRyeConfigBuilderconfigBuilder(io.smallrye.config.SmallRyeConfigBuilder builder, List<ConfigBuilder> configBuilders)static io.smallrye.config.SmallRyeConfigBuilderemptyConfigBuilder()static booleanisPropertyPresent(String propertyName)Checks if a property is present in the current Configuration.static <T> IntFunction<List<T>>listFactory()static Map<String,String>loadRuntimeDefaultValues()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
-
QUARKUS_RUNTIME_CONFIG_DEFAULTS_PROPERTIES
public static final String QUARKUS_RUNTIME_CONFIG_DEFAULTS_PROPERTIES
- 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-trueif the configuration is run time,falseif build timeaddDiscovered-trueif 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-trueif the configuration is run time,falseif build timeaddDiscovered-trueif the ConfigSource and Converter objects should be auto-discovered- Returns:
- the configuration builder
-
emptyConfigBuilder
public static io.smallrye.config.SmallRyeConfigBuilder emptyConfigBuilder()
-
configBuilder
public static io.smallrye.config.SmallRyeConfigBuilder configBuilder(io.smallrye.config.SmallRyeConfigBuilder builder, List<ConfigBuilder> configBuilders)
-
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 in
ConfigSource.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.
-
-