Package org.sqlproc.engine.util
Class PropertiesLoader
java.lang.Object
org.sqlproc.engine.util.PropertiesLoader
The helper class for the property file loading. The property file can be located on the classpath, in the root
directory or in the user's home directory.
For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.slf4j.LoggerThe internal slf4j logger.private PropertiesProperties from the property file. -
Constructor Summary
ConstructorsConstructorDescriptionPropertiesLoader(String fileName, Class<?> loaderClass) Reads the property file and creates a new PropertiesLoader instance.PropertiesLoader(List<String> fileNames, Class<?> loaderClass) Reads the property files and creates a new PropertiesLoader instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the named property value from the property file.Returns all properties.static PropertiesgetProperties(Class<?> loaderClass, String fileName) Reads the property file and creates a new PropertiesLoader instance.static PropertiesgetProperties(Class<?> loaderClass, String... fileNames) Reads the property files and creates a new PropertiesLoader instance.private PropertiesReads the property file and creates a new Properties instance.
-
Field Details
-
logger
protected final org.slf4j.Logger loggerThe internal slf4j logger. -
properties
Properties from the property file.
-
-
Constructor Details
-
PropertiesLoader
Reads the property file and creates a new PropertiesLoader instance.- Parameters:
fileName- The name of the file to be read.loaderClass- Class used to detect the correct classloader.
-
PropertiesLoader
Reads the property files and creates a new PropertiesLoader instance.- Parameters:
fileNames- The names of the files to be read.loaderClass- Class used to detect the correct classloader.
-
-
Method Details
-
getProperties
Reads the property file and creates a new PropertiesLoader instance.- Parameters:
loaderClass- Class used to detect the correct classloader.fileName- The name of the file to be read.- Returns:
- all properties from the specified file(s)
-
getProperties
Reads the property files and creates a new PropertiesLoader instance.- Parameters:
loaderClass- Class used to detect the correct classloader.fileNames- The names of the files to be read.- Returns:
- all properties from the specified file(s)
-
load
Reads the property file and creates a new Properties instance.- Parameters:
fileName- The name of the file to be read.loaderClass- Class used to detect the correct classloader.- Returns:
- all properties from the specified file
-
get
Returns the named property value from the property file.- Parameters:
name- the name (=key in the property file)- Returns:
- the value of the property
-
getProperties
Returns all properties.- Returns:
- all properties
-