Interface ConfigValueConfigSource

  • All Superinterfaces:
    org.eclipse.microprofile.config.spi.ConfigSource
    All Known Implementing Classes:
    ConfigValuePropertiesConfigSource, MapBackedConfigValueConfigSource

    @Experimental("Extension to the original ConfigSource to allow retrieval of additional metadata on config lookup")
    public interface ConfigValueConfigSource
    extends org.eclipse.microprofile.config.spi.ConfigSource
    Extends the original ConfigSource to expose methods that return a ConfigValue. The ConfigValue allows to retrieve additional metadata associated with the configuration resolution.

    This is to work around the limitation from the original ConfigSource. It exposes everything as plain Strings and it is not possible to retrieve additional information associated with the Configuration. The ConfigValueConfigSource tries to make this possible.

    Ideally, this should move the MicroProfile Config API, once the concept is well-proven.

    • Method Detail

      • getConfigValue

        ConfigValue getConfigValue​(String propertyName)
        Return the ConfigValue for the specified property in this configuration source.
        Parameters:
        propertyName - the property name
        Returns:
        the ConfigValue, or null if the property is not present
      • getConfigValueProperties

        Map<String,​ConfigValue> getConfigValueProperties()
        Return the properties in this configuration source as a Map of String and ConfigValue.
        Returns:
        a map containing properties of this configuration source
      • getProperties

        default Map<String,​String> getProperties()
        Return the properties in this configuration source as a map.

        This wraps the original ConfigValue map returned by getConfigValueProperties() and provides a view over the original map via ConfigValueMapView.

        Specified by:
        getProperties in interface org.eclipse.microprofile.config.spi.ConfigSource
        Returns:
        a map containing properties of this configuration source
      • getValue

        default String getValue​(String propertyName)
        Return the value for the specified property in this configuration source.

        This wraps the original ConfigValue returned by getConfigValue(String) and unwraps the property value contained ConfigValue. If the ConfigValue is null the unwrapped value and return is also null.

        Specified by:
        getValue in interface org.eclipse.microprofile.config.spi.ConfigSource
        Parameters:
        propertyName - the property name
        Returns:
        the property value, or null if the property is not present