net.landspurg.util
Class Settings

java.lang.Object
  extended by net.landspurg.util.Settings

public class Settings
extends java.lang.Object

A class for storing and retrieving application settings and properties. Class stores all settings into one Hashtable variable. Hashtable is loaded from RecordStore at initialization and it is stored back to the RecordStore with save method.


Method Summary
 boolean getBooleanProperty(java.lang.String name, boolean defaultValue)
          Get boolean property
static Settings getInstance(javax.microedition.midlet.MIDlet midlet, java.lang.String inName)
          Singleton pattern is used to return only one instance of record store
 int getIntProperty(java.lang.String name, int defaultValue)
          Get integer property
 java.util.Hashtable getProperties()
           
 java.lang.String getStringProperty(java.lang.String name, java.lang.String defaultValue)
          Get string property
 void save(boolean force)
          Save property Hashtable to record store
 void setBooleanProperty(java.lang.String name, boolean value)
          Set a boolean property
 void setIntProperty(java.lang.String name, int value)
          Set an integer property
 boolean setStringProperty(java.lang.String name, java.lang.String value)
          Set a string property
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Settings getInstance(javax.microedition.midlet.MIDlet midlet,
                                   java.lang.String inName)
                            throws java.io.IOException,
                                   javax.microedition.rms.RecordStoreException
Singleton pattern is used to return only one instance of record store

Throws:
java.io.IOException
javax.microedition.rms.RecordStoreException

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name,
                                  boolean defaultValue)
Get boolean property


getIntProperty

public int getIntProperty(java.lang.String name,
                          int defaultValue)
Get integer property


getStringProperty

public java.lang.String getStringProperty(java.lang.String name,
                                          java.lang.String defaultValue)
Get string property


save

public void save(boolean force)
Save property Hashtable to record store


setBooleanProperty

public void setBooleanProperty(java.lang.String name,
                               boolean value)
Set a boolean property


setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
Set an integer property


setStringProperty

public boolean setStringProperty(java.lang.String name,
                                 java.lang.String value)
Set a string property


getProperties

public java.util.Hashtable getProperties()