Class ConfigReader<ConfigType>

  • Type Parameters:
    ConfigType - The config type.
    Direct Known Subclasses:
    ConfigReader.YamlConfigReader

    public abstract class ConfigReader<ConfigType>
    extends Object
    A helper class to load config files from disk and parse into the specified config type.
    • Constructor Detail

      • ConfigReader

        protected ConfigReader()
        Protected constructor.
    • Method Detail

      • readConfig

        public ConfigType readConfig​(Path file)
                              throws IOException
        Parameters:
        file - File path to load config from.
        Returns:
        The loaded config file.
        Throws:
        IOException - If reading the config file failed.
      • parseConfig

        protected abstract ConfigType parseConfig​(String fileName,
                                                  InputStream stream)
                                           throws IOException
        Parse config file into the designated type.
        Parameters:
        fileName - File name that is parsed. In case this has influence on the parsing.
        stream - The file input stream to read from.
        Returns:
        The parsed config file.
        Throws:
        IOException - If parsing failed.