Class ConfigRetriever
java.lang.Object
com.github.rlacher.sortbench.config.ConfigRetriever
Utility class for validating and retrieving configuration values from a map.
Expands on standard CLI argument validation with context-specific configuration checks.
-
Method Summary
-
Method Details
-
validateAndFilterMap
public static <T> Map<String,T> validateAndFilterMap(Map<String, T> config, Set<String> keys, boolean throwIfNotFound) Validates and retrieves configuration values from a map based on a set of keys.This method ignores the case and leading/trailing whitespaces of the keys.
If a key is not found, it will be ignored unless
throwIfNotFoundistrue.- Type Parameters:
T- The type of the configuration values.- Parameters:
config- The map containing the configuration.keys- A set of keys to look for in the configuration map (case-insensitive).throwIfNotFound- Iftrue, an exception is thrown if a key inkeysis not found in the config.- Returns:
- A map of the found configuration values.
- Throws:
IllegalArgumentException- Ifconfigisnull,keysisnull, any key inkeysisnullor blank, or if a key inkeysis not found in the config andthrowIfNotFoundistrue.
-