Package org.confng.internal
Class ConfigLoader
- java.lang.Object
-
- org.confng.internal.ConfigLoader
-
public final class ConfigLoader extends Object
Internal helper class responsible for loading configuration files. This class handles the detection and loading of various configuration file formats.This is an internal class and should not be used directly by clients. Use
ConfNGinstead.- Since:
- 1.0
- Author:
- Bharat Kumar Malviya
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidload(String filePath, String environment, Consumer<ConfigSource> sourceRegistrar)Loads a configuration file with environment-specific section.static voidload(String filePath, Consumer<ConfigSource> sourceRegistrar)Loads a configuration file by auto-detecting its type based on the file extension.static voidloadJson(String filePath, String environment, Consumer<ConfigSource> sourceRegistrar)Loads a JSON file.static voidloadProperties(String filePath, Consumer<ConfigSource> sourceRegistrar)Loads a properties file.static voidloadToml(String filePath, String environment, Consumer<ConfigSource> sourceRegistrar)Loads a TOML file.static voidloadYaml(String filePath, String environment, Consumer<ConfigSource> sourceRegistrar)Loads a YAML file.
-
-
-
Method Detail
-
load
public static void load(String filePath, Consumer<ConfigSource> sourceRegistrar)
Loads a configuration file by auto-detecting its type based on the file extension.- Parameters:
filePath- path to the configuration filesourceRegistrar- callback to register the loaded source
-
load
public static void load(String filePath, String environment, Consumer<ConfigSource> sourceRegistrar)
Loads a configuration file with environment-specific section.- Parameters:
filePath- path to the configuration fileenvironment- the environment section to loadsourceRegistrar- callback to register the loaded source
-
loadProperties
public static void loadProperties(String filePath, Consumer<ConfigSource> sourceRegistrar)
Loads a properties file.
-
loadJson
public static void loadJson(String filePath, String environment, Consumer<ConfigSource> sourceRegistrar)
Loads a JSON file.
-
loadYaml
public static void loadYaml(String filePath, String environment, Consumer<ConfigSource> sourceRegistrar)
Loads a YAML file.
-
loadToml
public static void loadToml(String filePath, String environment, Consumer<ConfigSource> sourceRegistrar)
Loads a TOML file.
-
-