Class ConfigUtils


  • public final class ConfigUtils
    extends Object
    • 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

      • 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 time
        addDiscovered - 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 time
        addDiscovered - 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 builder
        provider - 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 builder
        providers - 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.