Package com.saperion.ngc.configuration
Class PropertyFileLoader
- java.lang.Object
-
- com.saperion.ngc.configuration.PropertyFileLoader
-
public final class PropertyFileLoader extends java.lang.ObjectUtility class to handle property-files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>loadFromClasspathAsMap(java.lang.String path, boolean caseSensitive)Loads the properties in the specified file.static java.util.Map<java.lang.String,java.lang.String>loadFromClasspathAsMapIgnoringError(java.lang.String path, boolean caseSensitive)Loads the properties in the specified file.
-
-
-
Method Detail
-
loadFromClasspathAsMap
public static java.util.Map<java.lang.String,java.lang.String> loadFromClasspathAsMap(java.lang.String path, boolean caseSensitive) throws java.io.IOExceptionLoads the properties in the specified file. The file is expected to be in standard-properties format. The file is loaded by usingClass.getResourceAsStream(String). The keys of the returned map are not case sensitive.- Parameters:
path- the path of the file (including name)caseSensitive- whether to create a map with case-sensitive keys or not- Returns:
- properies loaded from the file in a map. Never null.
- Throws:
java.io.IOException- when loading the file failed
-
loadFromClasspathAsMapIgnoringError
public static java.util.Map<java.lang.String,java.lang.String> loadFromClasspathAsMapIgnoringError(java.lang.String path, boolean caseSensitive)Loads the properties in the specified file. The file is expected to be in standard-properties format. The file is loaded by usingClass.getResourceAsStream(String). The keys of the returned map are not case sensitive. If the file could not be read, an empty map is returned.- Parameters:
path- the path of the file (including name)caseSensitive- whether to create a map with case-sensitive keys or not- Returns:
- properies loaded from the file in a map. Never null.
-
-