ca.sqlpower.architect
Class AbstractUserSetting

java.lang.Object
  extended by ca.sqlpower.architect.AbstractUserSetting
All Implemented Interfaces:
UserSettings
Direct Known Subclasses:
ArchitectSwingUserSettings, DDLUserSettings, ETLUserSettings, QFAUserSettings

public abstract class AbstractUserSetting
extends java.lang.Object
implements UserSettings


Field Summary
protected  java.util.Map settings
           
 
Constructor Summary
AbstractUserSetting()
           
 
Method Summary
 boolean getBoolean(java.lang.String propName, boolean defaultValue)
          Gets the named property from the settings map.
 int getInt(java.lang.String propName, int defaultValue)
          Gets the named property from the settings map.
 java.lang.Object getObject(java.lang.String propName, java.lang.Object defaultValue)
           
 java.util.Set getSettingNames()
          Returns the names of all settings currently held by this SwingUserSettings object.
 java.lang.String getString(java.lang.String propName, java.lang.String defaultValue)
           
 void putSetting(java.lang.String propName, java.lang.String propClassName, java.lang.String propValue)
          Adds a new setting or updates the value of an existing setting.
 void setBoolean(java.lang.String propName, boolean value)
           
 void setInt(java.lang.String propName, int value)
           
 void setObject(java.lang.String propName, java.lang.Object value)
           
 void setString(java.lang.String propName, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

settings

protected java.util.Map settings
Constructor Detail

AbstractUserSetting

public AbstractUserSetting()
Method Detail

getInt

public int getInt(java.lang.String propName,
                  int defaultValue)
Gets the named property from the settings map. If the value in the map is a Number, the value is obtained by calling intValue() on it. If it is a String, it is converted with Integer.parseInt(). Otherwise, the default value is returned a warning is logged using logger. If there is no such value in the map, the default is returned without logging a warning.

Specified by:
getInt in interface UserSettings

setInt

public void setInt(java.lang.String propName,
                   int value)
Specified by:
setInt in interface UserSettings

getBoolean

public boolean getBoolean(java.lang.String propName,
                          boolean defaultValue)
Gets the named property from the settings map. If the value in the map is a Boolean, the value is obtained by calling booleanValue() on it. If it is a String, it is converted with Boolean.parseBoolean(). Otherwise, the default value is returned and a warning is logged using logger. If there is no such value in the map, the default is returned without logging a warning.

Specified by:
getBoolean in interface UserSettings

setBoolean

public void setBoolean(java.lang.String propName,
                       boolean value)
Specified by:
setBoolean in interface UserSettings

setObject

public void setObject(java.lang.String propName,
                      java.lang.Object value)
Specified by:
setObject in interface UserSettings

putSetting

public void putSetting(java.lang.String propName,
                       java.lang.String propClassName,
                       java.lang.String propValue)
Adds a new setting or updates the value of an existing setting. This method is meant to be used by the ConfigFile read method: The set<Type> methods are an easier interface to the same thing.

Specified by:
putSetting in interface UserSettings
Parameters:
propName - The name of the property to add or update.
propClassName - The class name of the property's value. Currently, "java.lang.Integer" and "java.lang.Boolean" are supported.
propValue - A string representation of the property's value.

getString

public java.lang.String getString(java.lang.String propName,
                                  java.lang.String defaultValue)
Specified by:
getString in interface UserSettings

setString

public void setString(java.lang.String propName,
                      java.lang.String value)
Specified by:
setString in interface UserSettings

getObject

public java.lang.Object getObject(java.lang.String propName,
                                  java.lang.Object defaultValue)
Specified by:
getObject in interface UserSettings

getSettingNames

public java.util.Set getSettingNames()
Returns the names of all settings currently held by this SwingUserSettings object. They will all be Strings.

Specified by:
getSettingNames in interface UserSettings


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca