Class DeprecatedMpConfig

java.lang.Object
io.helidon.config.mp.DeprecatedMpConfig

public final class DeprecatedMpConfig extends Object
A utility class to handle MicroProfile configuration properties that should no longer be used.

For one major release, the property is retrieved through this class, to warn about the usage. In next major release, the deprecated property is removed (as is use of this class).

This class is closely patterned after io.helidon.config.DeprecatedConfig and works whether the MP config object is proxied by CDI or not. That other class can be used in conjunction with MpConfig.toHelidonConfig(org.eclipse.microprofile.config.Config) for MP config objects that are not injected but that does work for MP config objects proxied by CDI. This one does work for those use cases.

  • Method Details

    • getConfigValue

      public static <T> Optional<T> getConfigValue(Config config, Class<T> type, String currentKey, String deprecatedKey)
      Get a value from config, attempting to read both the keys. Warning is logged if either the current key is not defined, or both the keys are defined.
      Type Parameters:
      T - type of the retrieved value
      Parameters:
      config - configuration instance
      type - type of the retrieved value
      currentKey - key that should be used
      deprecatedKey - key that should not be used
      Returns:
      config value of the current key if exists, or the deprecated key if it does not, an empty Optional otherwise