Class FilePropertiesLoader
java.lang.Object
com.saperion.common.config.loader.AbstractPropertiesLoader
com.saperion.common.config.loader.FilePropertiesLoader
- All Implemented Interfaces:
PropertiesLoader
This FilePropertiesLoader loads '.properties'-files. When loading a file it first attempts to find the file
in the class-path. If not found, it tries to find the file in the file-system.
The path to look for the PropertiesResources to load can be configured using the according constructor.
An instance of this FilePropertiesLoader can be used in several threads concurrently.
- Author:
- sts
-
Constructor Summary
ConstructorsConstructorDescriptionFilePropertiesLoader(String filePath) Constructs aFilePropertiesLoaderusing the given file-path. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetFileName(PropertiesResource propertiesResource) Returns the filename used by thisPropertiesLoaderwhen it tries to load the givenPropertiesResource.getFilePath(PropertiesResource propertiesResource) Returns the file path build by thisPropertiesLoaderwhen it tries to load the givenPropertiesResource.load(PropertiesResource propertiesResource) Loads the givenPropertiesResourceif present.toString()Methods inherited from class com.saperion.common.config.loader.AbstractPropertiesLoader
loadAsMap
-
Constructor Details
-
FilePropertiesLoader
Constructs aFilePropertiesLoaderusing the given file-path. The file-path is appended as prefix to the file name when thisPropertiesLoaderloads aPropertiesResource.- Parameters:
filePath- the file-path to use for loading thePropertiesResources. May not benullor empty.
-
-
Method Details
-
load
Description copied from interface:PropertiesLoaderLoads the givenPropertiesResourceif present. Returns the properties as aPropertiesobject.- Parameters:
propertiesResource- thePropertiesResourceto load.- Returns:
- the loaded
Properties - Throws:
ConfigurationException- if thePropertiesResourcecould not be loaded.- See Also:
-
getFileName
Returns the filename used by thisPropertiesLoaderwhen it tries to load the givenPropertiesResource.- Parameters:
propertiesResource- thePropertiesResourceto get the filename for.- Returns:
- filename used by this
PropertiesLoaderwhen it loads the givenPropertiesResource
-
getFilePath
Returns the file path build by thisPropertiesLoaderwhen it tries to load the givenPropertiesResource.- Parameters:
propertiesResource- thePropertiesResourceto get the search path for.- Returns:
- the file path build by this
PropertiesLoaderwhen it tries to load the givenPropertiesResource.
-
toString
-