Interface ConfigValueConfigSource

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

public interface ConfigValueConfigSource extends org.eclipse.microprofile.config.spi.ConfigSource
Extends the original ConfigSource to expose methods that return a ConfigValue. The ConfigValue allows retrieving additional metadata associated with the configuration resolution.

This works around the MicroProfile Config ConfigSource limitations, which exposes everything as plain Strings, and retrieving additional information associated with the Configuration is impossible. The ConfigValueConfigSource tries to make this possible.

  • Method Details

    • 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 ConfigValueConfigSource.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