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:
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceConfigurationLoader.Defaultsstatic classConfigurationLoader.FileLoaderstatic classConfigurationLoader.InputStreamLoaderstatic classConfigurationLoader.PathLoaderstatic classConfigurationLoader.UrlLoader -
Method Summary
Modifier and Type Method Description StringloadConfiguration()Loads the configuration from the given resource.static ConfigurationLoaderNew(File file)Tries to load the configuration fromfile.static ConfigurationLoaderNew(File file, Charset charset)Tries to load the configuration fromfile.static ConfigurationLoaderNew(InputStream inputStream)Tries to load the configuration from theInputStreaminputStream.static ConfigurationLoaderNew(InputStream inputStream, Charset charset)Tries to load the configuration from theInputStreaminputStream.static ConfigurationLoaderNew(String path)Loads the configuration from the given resource.static ConfigurationLoaderNew(String path, Charset charset)Loads the configuration from the given resource.static ConfigurationLoaderNew(URL url)Tries to load the configuration from the URLurl.static ConfigurationLoaderNew(URL url, Charset charset)Tries to load the configuration from the URLurl.static ConfigurationLoaderNew(Path path)Tries to load the configuration frompath.static ConfigurationLoaderNew(Path path, Charset charset)Tries to load the configuration frompath.
-
Method Details
-
loadConfiguration
String loadConfiguration()Loads the configuration from the given resource.- Returns:
- the configuration resource's content.
- Throws:
StorageConfigurationException- if an error occurs while loading the resource
-
New
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
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 URLcharset- 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
Tries to load the configuration frompath.- Parameters:
path- file system path- Returns:
- the configuration
- Throws:
StorageConfigurationException- if the configuration couldn't be loaded
-
New
Tries to load the configuration frompath.- Parameters:
path- file system pathcharset- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException- if the configuration couldn't be loaded
-
New
Tries to load the configuration fromfile.- Parameters:
file- file path- Returns:
- the configuration
- Throws:
StorageConfigurationException- if the configuration couldn't be loaded
-
New
Tries to load the configuration fromfile.- Parameters:
file- file pathcharset- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException- if the configuration couldn't be loaded
-
New
Tries to load the configuration from the URLurl.- Parameters:
url- URL path- Returns:
- the configuration
- Throws:
StorageConfigurationException- if the configuration couldn't be loaded
-
New
Tries to load the configuration from the URLurl.- Parameters:
url- URL pathcharset- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException- if the configuration couldn't be loaded
-
New
Tries to load the configuration from theInputStreaminputStream.- Parameters:
inputStream- the stream to read from- Returns:
- the configuration
- Throws:
StorageConfigurationException- if the configuration couldn't be loaded
-
New
Tries to load the configuration from theInputStreaminputStream.- Parameters:
inputStream- the stream to read fromcharset- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException- if the configuration couldn't be loaded
-