Package org.confng.sources
Interface ConfigSource
-
- All Known Implementing Classes:
EnvSource,JsonSource,PropertiesSource,SecretManagerSource,SystemPropertySource,TestNGParameterSource,TomlSource,YamlSource
public interface ConfigSourceInterface for configuration sources used by ConfNG.This interface defines the contract for configuration sources that can provide configuration values to the ConfNG system. Implementations can read from various sources such as environment variables, system properties, properties files, JSON files, or custom sources.
- Since:
- 1.0
- Author:
- Bharat Kumar Malviya, GitHub: github.com/imBharatMalviya
- See Also:
ConfNG
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Optional<String>get(String key)Retrieves a configuration value for the given key.StringgetName()Returns the name of this configuration source.default intgetPriority()Returns the priority of this configuration source.
-
-
-
Method Detail
-
getName
String getName()
Returns the name of this configuration source.- Returns:
- the source name, never null
-
get
Optional<String> get(String key)
Retrieves a configuration value for the given key.If the key is not found in this source, an empty Optional should be returned. This allows the ConfNG system to try other sources in the resolution chain.
- Parameters:
key- the configuration key to look up- Returns:
- an Optional containing the value if found, empty otherwise
-
getPriority
default int getPriority()
Returns the priority of this configuration source.Sources with higher priority values are consulted first in the resolution chain. Default priorities:
- 100+ - Secret managers and secure sources
- 80-99 - TestNG parameters and test-specific sources
- 60-79 - Environment variables
- 40-59 - System properties
- 20-39 - Configuration files (JSON, Properties)
- 0-19 - Default and fallback sources
- Returns:
- the priority value, higher values have higher priority
-
-