Class ConfigurationReader


  • public final class ConfigurationReader
    extends Object
    Utility class for reading and deserialization of configuration
    Author:
    Brian Wyka
    • Field Detail

      • MAPPER

        public static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
        The object mapper which is used to deserialize the configuration from file
    • Method Detail

      • parseConfiguration

        public static SourcehawkConfiguration parseConfiguration​(Path configurationFilePath)
                                                          throws IOException
        Parse the configuration from the provided file
        Parameters:
        configurationFilePath - the configuration file path
        Returns:
        the configuration
        Throws:
        IOException
      • readConfiguration

        public static Optional<SourcehawkConfiguration> readConfiguration​(Path repositoryRoot,
                                                                          String configurationFileLocation)
        Read the configuration from the provided location
        Parameters:
        repositoryRoot - the repository root
        configurationFileLocation - the config file location
        Returns:
        the configuration
      • parseFileEnforcer

        public static FileEnforcer parseFileEnforcer​(Object fileEnforcerObject)
        Parse the file enforcer
        Parameters:
        fileEnforcerObject - the file enforcer object
        Returns:
        the file enforcer
      • convertFileEnforcerToFileResolver

        public static Optional<FileResolver> convertFileEnforcerToFileResolver​(Object fileEnforcerObject)
        Convert the file enforcer to a file resolver
        Parameters:
        fileEnforcerObject - the file enforcer object
        Returns:
        the file resolver if able to be converted, otherwise Optional.empty()