com.valhalla.settings
Class Settings

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties
              extended bycom.valhalla.settings.Settings
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class Settings
extends java.util.Properties

A singleton Properties class to access and save settings

Version:
1.0
Author:
Adam Olsen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Method Summary
 boolean getBoolean(java.lang.String key)
          Gets a boolean value
static Settings getInstance()
          Gets the Settings instance
 java.io.File getSettingsDir()
          Gets the settings directory
 java.io.File getSettingsFile()
          Gets the settings file
static void loadSettings(java.lang.String dir, java.lang.String settingsFile)
          Reads the settings file and sets up the singleton
 void setBoolean(java.lang.String key, boolean value)
          Sets a boolean
static void setSettings(java.util.Properties settings)
          Sets the settings
static void writeSettings()
          Writes the settings to the settings file
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

loadSettings

public static void loadSettings(java.lang.String dir,
                                java.lang.String settingsFile)
Reads the settings file and sets up the singleton

Parameters:
dir - the settings directory
settingsFile - the settings file

getInstance

public static Settings getInstance()
Gets the Settings instance

Returns:
the Settings singleton

getSettingsDir

public java.io.File getSettingsDir()
Gets the settings directory

Returns:
the settings directory

getSettingsFile

public java.io.File getSettingsFile()
Gets the settings file

Returns:
the settings file

getBoolean

public boolean getBoolean(java.lang.String key)
Gets a boolean value

Parameters:
key - the key to get a boolean for
Returns:
a boolean based on the key

setBoolean

public void setBoolean(java.lang.String key,
                       boolean value)
Sets a boolean

Parameters:
key - the key to set
value - the value to set the key to

setSettings

public static void setSettings(java.util.Properties settings)
Sets the settings

Parameters:
settings - the settings to set it to

writeSettings

public static void writeSettings()
Writes the settings to the settings file