Package be.panako.util
Class Config
java.lang.Object
be.panako.util.Config
public class Config
extends java.lang.Object
Writes and read the configuration values to and from a properties file.
- Author:
- Joren Six
-
Constructor Summary
Constructors Constructor Description Config()Hidden default constructor. -
Method Summary
Modifier and Type Method Description static java.lang.Stringget(Key key)static booleangetBoolean(Key key)static floatgetFloat(Key key)static ConfiggetInstance()static intgetInt(Key key)static java.lang.StringgetPreference(java.lang.String key)Use preferences to store configuration that changes during runtime and need to be persisted.java.lang.StringreadPreference(java.lang.String preferenceKey)static voidset(Key key, java.lang.String value)Sets a configuration value to use during the runtime of the application.static voidsetPreference(java.lang.String key, java.lang.String value)Use preferences to store configuration that changes during runtime and need to be persisted.voidwritePreference(java.lang.String preferenceKey, java.lang.String value)Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Config
public Config()Hidden default constructor. Reads the configured values, or stores the defaults.
-
-
Method Details
-
writePreference
public void writePreference(java.lang.String preferenceKey, java.lang.String value) -
readPreference
public java.lang.String readPreference(java.lang.String preferenceKey) -
getInstance
-
get
-
getInt
-
getFloat
-
getBoolean
-
set
Sets a configuration value to use during the runtime of the application. These configuration values are not persisted. To- Parameters:
key- The key to set.value- The value to use.
-
setPreference
public static void setPreference(java.lang.String key, java.lang.String value)Use preferences to store configuration that changes during runtime and need to be persisted.- Parameters:
key- The key to store.value- The value to store
-
getPreference
public static java.lang.String getPreference(java.lang.String key)Use preferences to store configuration that changes during runtime and need to be persisted.- Parameters:
key- The key to store.- Returns:
- The configured preference value.
-