Package com.github.ngoanh2n
Class PropertiesFile
java.lang.Object
com.github.ngoanh2n.PropertiesFile
- Since:
- 2019
-
Constructor Summary
ConstructorDescriptionPropertiesFile
(File file) Construct a newPropertiesFile
by aFile
.PropertiesFile
(File file, boolean assignToSystem) Construct a newPropertiesFile
by aFile
.PropertiesFile
(String resourceName) Construct a newPropertiesFile
by a resource name.PropertiesFile
(String resourceName, boolean assignToSystem) Construct a newPropertiesFile
by a resource name. -
Method Summary
Modifier and TypeMethodDescriptionGet all properties in this file.<T> T
getProperty
(Property<T> property) Get the value of property by other property.
Priority order: JVM System Property, Properties file, Default value.getProperty
(String name) Get the value of property by name.
Priority order: JVM System Property, Properties file.
-
Constructor Details
-
PropertiesFile
Construct a newPropertiesFile
by a resource name.- Parameters:
resourceName
- The properties file name in resources dir to read.
-
PropertiesFile
Construct a newPropertiesFile
by a resource name.- Parameters:
resourceName
- The properties file name in resources dir to read.assignToSystem
- Indicate to set all properties in file to system.
-
PropertiesFile
Construct a newPropertiesFile
by aFile
.- Parameters:
file
- The properties file to read.
-
PropertiesFile
Construct a newPropertiesFile
by aFile
.- Parameters:
file
- The properties file to read.assignToSystem
- Indicate to set all properties in file to system.
-
-
Method Details
-
getProperty
Get the value of property by name.
Priority order: JVM System Property, Properties file.- Parameters:
name
- The name of property.- Returns:
- The value of property as
String
.
-
getProperty
Get the value of property by other property.
Priority order: JVM System Property, Properties file, Default value. -
getProperties
Get all properties in this file.- Returns:
- All properties have been read.
-