- java.lang.Object
-
- net.morimekta.config.readers.YamlConfigReader<ConfigType>
-
- Type Parameters:
ConfigType- The config type.
- All Implemented Interfaces:
ConfigReader<ConfigType>
public class YamlConfigReader<ConfigType> extends Object implements ConfigReader<ConfigType>
Read config as YAML.
-
-
Constructor Summary
Constructors Constructor Description YamlConfigReader(Class<ConfigType> configType)YamlConfigReader(Class<ConfigType> configType, Consumer<com.fasterxml.jackson.databind.ObjectMapper> init)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigTypereadConfig(Path file)
-
-
-
Constructor Detail
-
YamlConfigReader
public YamlConfigReader(Class<ConfigType> configType)
- Parameters:
configType- The config type class.
-
YamlConfigReader
public YamlConfigReader(Class<ConfigType> configType, Consumer<com.fasterxml.jackson.databind.ObjectMapper> init)
- Parameters:
configType- The config type class.init- A consumer callback to initialize the object mapper. E.g. if extra modules needs to be loaded.
-
-
Method Detail
-
readConfig
public ConfigType readConfig(Path file) throws IOException, ConfigException
- Specified by:
readConfigin interfaceConfigReader<ConfigType>- Parameters:
file- File path to load config from.- Returns:
- The loaded config file.
- Throws:
IOException- If reading the config file failed.ConfigException- If parsing file failed.
-
-