org.jdiseq.util
Class SettingUtil

java.lang.Object
  extended byorg.jdiseq.util.SettingUtil

public class SettingUtil
extends java.lang.Object

Class for fetching all application settings.

Since:
version 1.0
Version:
$Id: SettingUtil.java,v 1.2 2003/08/17 13:15:53 trondandersen Exp $
Author:
Trond Andersen

Method Summary
 boolean getBooleanSetting(java.lang.String settingKey)
           
static SettingUtil getInstance()
          Singleton implementation
 int getIntSetting(java.lang.String settingKey)
           
 java.lang.String getSetting(java.lang.String settingKey)
          Retrieves the application and system setting.
 java.lang.String getSetting(java.lang.String settingKey, java.lang.String defaultValue)
           
protected  java.io.InputStream getSettingStream()
          Creates an InputStream to read the property file containing all the settings defined for the applicaton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SettingUtil getInstance()
Singleton implementation

Returns:
Singleton instance of SettingUtil

getSetting

public java.lang.String getSetting(java.lang.String settingKey)
Retrieves the application and system setting.

Parameters:
settingKey - used to look up settings
Returns:
the setting for the given key
Throws:
java.lang.RuntimeException - if setting doesn't exists

getSetting

public java.lang.String getSetting(java.lang.String settingKey,
                                   java.lang.String defaultValue)
Parameters:
settingKey - key to setting defined in property file
defaultValue - default value if the key isn't found
Returns:
String representation of the property

getIntSetting

public int getIntSetting(java.lang.String settingKey)
Parameters:
settingKey - key to setting defined in property file
Returns:
int representation of the value
Throws:
java.lang.NumberFormatException - Failed to parse an integer value

getBooleanSetting

public boolean getBooleanSetting(java.lang.String settingKey)
Parameters:
settingKey - key to setting defined in property file
Returns:
boolean representation of the value

getSettingStream

protected java.io.InputStream getSettingStream()
                                        throws java.io.IOException
Creates an InputStream to read the property file containing all the settings defined for the applicaton.

Returns:
Stream to the file containing all the settings
Throws:
java.io.IOException - when reading the file fails.


Copyright © 2003 SourceForge.net. All Rights Reserved.