Interface ConfigurationLoader

All Known Implementing Classes:
ConfigurationLoader.FileLoader, ConfigurationLoader.InputStreamLoader, ConfigurationLoader.PathLoader, ConfigurationLoader.UrlLoader
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface
public interface ConfigurationLoader
Loader for external configuration resources.

Supported resource types:

See Also:
Configuration.Builder.load(ConfigurationLoader, ConfigurationParser)
  • Method Details

    • loadConfiguration

      String loadConfiguration()
      Loads the configuration from the given resource.
      Returns:
      the configuration resource's content.
      Throws:
      ConfigurationException - if an error occurs while loading the resource
    • New

      static ConfigurationLoader New​(String path)
      Loads the configuration from the given resource.

      The load order is as follows:

      • The classpath
      • As an URL
      • As a file
      Parameters:
      path - a classpath resource, a file path or an URL
      Returns:
      the configuration resource's content.
      Throws:
      ConfigurationExceptionNoConfigurationFound - if no configuration can be found at the given path
    • New

      static ConfigurationLoader New​(String path, Charset charset)
      Loads the configuration from the given resource.

      The load order is as follows:

      • The classpath
      • As an URL
      • As a file
      Parameters:
      path - a classpath resource, a file path or an URL
      charset - the charset used to load the configuration
      Returns:
      the configuration resource's content.
      Throws:
      ConfigurationExceptionNoConfigurationFound - if no configuration can be found at the given path
    • New

      static ConfigurationLoader New​(Path path)
      Tries to load the configuration from path.
      Parameters:
      path - file system path
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • New

      static ConfigurationLoader New​(Path path, Charset charset)
      Tries to load the configuration from path.
      Parameters:
      path - file system path
      charset - the charset used to load the configuration
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • New

      static ConfigurationLoader New​(File file)
      Tries to load the configuration from file.
      Parameters:
      file - file path
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • New

      static ConfigurationLoader New​(File file, Charset charset)
      Tries to load the configuration from file.
      Parameters:
      file - file path
      charset - the charset used to load the configuration
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • New

      static ConfigurationLoader New​(URL url)
      Tries to load the configuration from the URL url.
      Parameters:
      url - URL path
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • New

      static ConfigurationLoader New​(URL url, Charset charset)
      Tries to load the configuration from the URL url.
      Parameters:
      url - URL path
      charset - the charset used to load the configuration
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • New

      static ConfigurationLoader New​(InputStream inputStream)
      Tries to load the configuration from the InputStream inputStream.
      Parameters:
      inputStream - the stream to read from
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • New

      static ConfigurationLoader New​(InputStream inputStream, Charset charset)
      Tries to load the configuration from the InputStream inputStream.
      Parameters:
      inputStream - the stream to read from
      charset - the charset used to load the configuration
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded