Class SmallRyeConfig

    • Method Detail

      • getValues

        public <T> List<T> getValues​(String propertyName,
                                     Class<T> propertyType)
        Specified by:
        getValues in interface org.eclipse.microprofile.config.Config
      • getValues

        public <T,​C extends Collection<T>> C getValues​(String name,
                                                             org.eclipse.microprofile.config.spi.Converter<T> converter,
                                                             IntFunction<C> collectionFactory)
      • getIndexedValues

        public <T,​C extends Collection<T>> C getIndexedValues​(String name,
                                                                    org.eclipse.microprofile.config.spi.Converter<T> converter,
                                                                    IntFunction<C> collectionFactory)
      • getIndexedProperties

        public List<String> getIndexedProperties​(String property)
      • getIndexedPropertiesIndexes

        public List<Integer> getIndexedPropertiesIndexes​(String property)
      • getValue

        public <T> T getValue​(String name,
                              Class<T> aClass)
        Specified by:
        getValue in interface org.eclipse.microprofile.config.Config
      • getValues

        @Experimental("Extension to retrieve mandatory sub properties as a Map")
        public <K,​V> Map<K,​V> getValues​(String name,
                                                    Class<K> kClass,
                                                    Class<V> vClass)
        Return the content of the direct sub properties as the requested type of Map.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        name - The configuration property name
        kClass - the type into which the keys should be converted
        vClass - the type into which the values should be converted
        Returns:
        the resolved property value as an instance of the requested Map (not null)
        Throws:
        IllegalArgumentException - if a key or a value cannot be converted to the specified types
        NoSuchElementException - if no direct sub properties could be found.
      • getValuesAsMap

        public <K,​V> Map<K,​V> getValuesAsMap​(String name,
                                                         org.eclipse.microprofile.config.spi.Converter<K> keyConverter,
                                                         org.eclipse.microprofile.config.spi.Converter<V> valueConverter)
        Return the content of the direct sub properties as the requested type of Map.
        Type Parameters:
        K - The type of the keys.
        V - The type of the values.
        Parameters:
        name - The configuration property name
        keyConverter - The converter to use for the keys.
        valueConverter - The converter to use for the values.
        Returns:
        the resolved property value as an instance of the requested Map or null if it could not be found.
        Throws:
        IllegalArgumentException - if a key or a value cannot be converted to the specified types
      • getValue

        public <T> T getValue​(String name,
                              org.eclipse.microprofile.config.spi.Converter<T> converter)
        This method handles calls from both Config.getValue(java.lang.String, java.lang.Class<T>) and Config.getOptionalValue(java.lang.String, java.lang.Class<T>).
      • convertValue

        public <T> T convertValue​(String name,
                                  String value,
                                  org.eclipse.microprofile.config.spi.Converter<T> converter)
        This method handles converting values for both CDI injections and programatical calls.

        Calls for converting non-optional values (Config.getValue(java.lang.String, java.lang.Class<T>) and "Injecting Native Values") should throw an Exception for each of the following:
        1. IllegalArgumentException - if the property cannot be converted by the Converter to the specified type
        2. NoSuchElementException - if the property is not defined
        3. NoSuchElementException - if the property is defined as an empty string
        4. NoSuchElementException - if the Converter returns null

        Calls for converting optional values (Config.getOptionalValue(java.lang.String, java.lang.Class<T>) and "Injecting Optional Values") should only throw an Exception for #1 (IllegalArgumentException when the property cannot be converted to the specified type).
      • rawValueEquals

        public boolean rawValueEquals​(String name,
                                      String expected)
        Determine whether the raw value of a configuration property is exactly equal to the expected given value.
        Parameters:
        name - the property name (must not be null)
        expected - the expected value (may be null)
        Returns:
        true if the values are equal, false otherwise
      • getConfigValue

        @Experimental("Extension to the original ConfigSource to allow retrieval of additional metadata on config lookup")
        public ConfigValue getConfigValue​(String name)
        Specified by:
        getConfigValue in interface org.eclipse.microprofile.config.Config
      • getRawValue

        public String getRawValue​(String name)
        Get the raw value of a configuration property.
        Parameters:
        name - the property name (must not be null)
        Returns:
        the raw value, or null if no property value was discovered for the given property name
      • getOptionalValue

        public <T> Optional<T> getOptionalValue​(String name,
                                                Class<T> aClass)
        Specified by:
        getOptionalValue in interface org.eclipse.microprofile.config.Config
      • getOptionalValues

        @Experimental("Extension to retrieve non mandatory sub properties as a Map")
        public <K,​V> Optional<Map<K,​V>> getOptionalValues​(String name,
                                                                      Class<K> kClass,
                                                                      Class<V> vClass)
        Return the content of the direct sub properties as the requested type of Map.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        name - The configuration property name
        kClass - the type into which the keys should be converted
        vClass - the type into which the values should be converted
        Returns:
        the resolved property value as an instance of the requested Map (not null)
        Throws:
        IllegalArgumentException - if a key or a value cannot be converted to the specified types
      • getOptionalValue

        public <T> Optional<T> getOptionalValue​(String name,
                                                org.eclipse.microprofile.config.spi.Converter<T> converter)
      • getOptionalValues

        public <T> Optional<List<T>> getOptionalValues​(String propertyName,
                                                       Class<T> propertyType)
        Specified by:
        getOptionalValues in interface org.eclipse.microprofile.config.Config
      • getOptionalValues

        public <T,​C extends Collection<T>> Optional<C> getOptionalValues​(String name,
                                                                               org.eclipse.microprofile.config.spi.Converter<T> converter,
                                                                               IntFunction<C> collectionFactory)
      • getIndexedOptionalValues

        public <T,​C extends Collection<T>> Optional<C> getIndexedOptionalValues​(String name,
                                                                                      org.eclipse.microprofile.config.spi.Converter<T> converter,
                                                                                      IntFunction<C> collectionFactory)
      • getConfigMapping

        @Experimental("ConfigMapping API to group configuration properties")
        public <T> T getConfigMapping​(Class<T> type)
      • getConfigMapping

        @Experimental("ConfigMapping API to group configuration properties")
        public <T> T getConfigMapping​(Class<T> type,
                                      String prefix)
      • getPropertyNames

        public Iterable<String> getPropertyNames()
        Specified by:
        getPropertyNames in interface org.eclipse.microprofile.config.Config
      • isPropertyPresent

        @Experimental("Check if a property is present")
        public boolean isPropertyPresent​(String name)
        Checks if a property is present in the Config instance. Because ConfigSource.getPropertyNames() may not include all available properties, it is not possible to reliable determine if the property is present in the properties list. The property needs to be retrieved to make sure it exists. The lookup is done without expression expansion, because the expansion value may not be available and it not relevant for the final check.
        Parameters:
        name - the property name.
        Returns:
        true if the property is present or false otherwise.
      • getConfigSources

        public Iterable<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSources()
        Specified by:
        getConfigSources in interface org.eclipse.microprofile.config.Config
      • getConfigSources

        public Iterable<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSources​(Class<?> type)
      • getConfigSource

        @Experimental("To retrieve a ConfigSource by name")
        public Optional<org.eclipse.microprofile.config.spi.ConfigSource> getConfigSource​(String name)
      • convert

        public <T> T convert​(String value,
                             Class<T> asType)
      • getConverter$$bridge

        @Deprecated
        public <T> org.eclipse.microprofile.config.spi.Converter<T> getConverter$$bridge​(Class<T> asType)
        Deprecated.
      • getConverter

        public <T> Optional<org.eclipse.microprofile.config.spi.Converter<T>> getConverter​(Class<T> asType)
        Specified by:
        getConverter in interface org.eclipse.microprofile.config.Config
      • requireConverter

        public <T> org.eclipse.microprofile.config.spi.Converter<T> requireConverter​(Class<T> asType)
      • unwrap

        public <T> T unwrap​(Class<T> type)
        Specified by:
        unwrap in interface org.eclipse.microprofile.config.Config
      • getProfiles

        @Experimental("To retrieve active profiles")
        public List<String> getProfiles()