Package fi.utu.vbingm.thesis
Class Settings
java.lang.Object
fi.utu.vbingm.thesis.Settings
Loads application settings.
On first run the bundled defaults.properties resource (from
src/main/resources/) is copied to
~/.mavenproject/settings.properties. On subsequent runs the user's
copy is read instead, so any edits the user makes there are preserved.
The constructor accepting a Path makes this class easy to test —
tests can pass a temporary directory instead of the real home folder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of a setting, ornullif not found.Returns the path to the config directory.voidload()Ensures the config directory and settings file exist (copying bundled defaults if needed), then loads the properties into memory.
-
Constructor Details
-
Settings
Creates a Settings instance that stores user config in the given directory.- Parameters:
configDir- directory where the user's settings file is kept
-
Settings
public Settings()Creates a Settings instance using the default config directory (~/.mavenproject/).
-
-
Method Details
-
load
Ensures the config directory and settings file exist (copying bundled defaults if needed), then loads the properties into memory.- Throws:
IOException- if an I/O error occurs
-
get
Returns the value of a setting, ornullif not found.- Parameters:
key- the property key- Returns:
- the value, or
null
-
getConfigDir
Returns the path to the config directory.- Returns:
- config directory path
-