|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.argouml.application.configuration.ConfigurationHandler
This class provides a user configuration based upon properties.
This provides an implementation-free interface to a configuration
repository. Any classes which need to implement a configuration
datastore must extend this class.
All of the required behavioral logic for the configuration is
contained within this class, as public final methods. Any
storage-related logic must be handled by the extending class.
These methods are abstract.
This class is intimately related to
Configuration
.
Constructor Summary | |
ConfigurationHandler()
Anonymous constructor allows configuration changes. |
|
ConfigurationHandler(boolean changeable)
Constructor which optionally allows configuration changes. |
Method Summary | |
void |
addListener(ConfigurationKey key,
java.beans.PropertyChangeListener pcl)
Adds a property change listener.Static for simplicity of use. |
void |
addListener(java.beans.PropertyChangeListener pcl)
Adds a property change listener. |
boolean |
getBoolean(ConfigurationKey key,
boolean defaultValue)
Returns the boolean value of a configuration property. |
abstract java.lang.String |
getDefaultPath()
Returns a default configuration path. |
double |
getDouble(ConfigurationKey key,
double defaultValue)
Returns the numeric value of a configuration property. |
int |
getInteger(ConfigurationKey key,
int defaultValue)
Returns the numeric value of a configuration property. |
java.lang.String |
getString(ConfigurationKey key,
java.lang.String defaultValue)
Returns the string value of a configuration property. |
abstract java.lang.String |
getValue(java.lang.String key,
java.lang.String defaultValue)
Returns the string value of a configuration property. |
boolean |
hasKey(ConfigurationKey key)
Allows query for the existence of a configuration property. |
boolean |
isChangeable()
Indicates whether the configuration can be saved. |
boolean |
isChanged()
Indicates whether the configuration can be saved. |
boolean |
isLoaded()
Indicates whether the configuration has been loaded. |
boolean |
load(java.io.File file)
Load the configuration from a File . |
boolean |
load(java.net.URL url)
Load the configuration from a URL . |
boolean |
loadDefault()
Load the configuration from the default location. |
void |
removeListener(ConfigurationKey key,
java.beans.PropertyChangeListener pcl)
Removes a property change listener. |
void |
removeListener(java.beans.PropertyChangeListener pcl)
Removes a property change listener. |
boolean |
save(java.io.File file)
Save the configuration to a File . |
boolean |
save(java.net.URL url)
Save the configuration to a URL . |
boolean |
saveDefault()
Save the configuration to the location it was loaded from. |
boolean |
saveDefault(boolean force)
Save the configuration to the location it was loaded from. |
void |
setBoolean(ConfigurationKey key,
boolean value)
Sets the boolean value of a configuration property. |
void |
setDouble(ConfigurationKey key,
double value)
Sets the numeric value of a configuration property. |
void |
setInteger(ConfigurationKey key,
int value)
Sets the numeric value of a configuration property. |
void |
setString(ConfigurationKey key,
java.lang.String newValue)
Sets the string value of a configuration property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ConfigurationHandler()
public ConfigurationHandler(boolean changeable)
Method Detail |
public abstract java.lang.String getDefaultPath()
public final boolean loadDefault()
isLoaded()
public final boolean saveDefault()
public final boolean saveDefault(boolean force)
public final boolean isChangeable()
public final boolean isChanged()
public final boolean isLoaded()
public final boolean load(java.io.File file)
File
.
public final boolean load(java.net.URL url)
URL
.
public final boolean save(java.io.File file)
File
.
public final boolean save(java.net.URL url)
URL
.
public final java.lang.String getString(ConfigurationKey key, java.lang.String defaultValue)
key
- the configuration key to return.defaultValue
- the default value key to return
if the key is not found.
public final int getInteger(ConfigurationKey key, int defaultValue)
key
- the configuration key to return.defaultValue
- the default value key to return
if the key is not found.
public final double getDouble(ConfigurationKey key, double defaultValue)
key
- the configuration key to return.defaultValue
- the default value key to return
if the key is not found.
public final boolean getBoolean(ConfigurationKey key, boolean defaultValue)
key
- the configuration key to return.defaultValue
- the default value key to return
if the key is not found.
public final void setString(ConfigurationKey key, java.lang.String newValue)
key
- the configuration key to modify.newValue
- the value to set the key to.public final void setInteger(ConfigurationKey key, int value)
key
- the configuration key to modify.value
- the value to set the key to.public final void setDouble(ConfigurationKey key, double value)
key
- the configuration key to modify.value
- the value to set the key to.public final void setBoolean(ConfigurationKey key, boolean value)
key
- the configuration key to modify.value
- the value to set the key to.public final void addListener(java.beans.PropertyChangeListener pcl)
pcl
- The class which will listen for property changes.public final void removeListener(java.beans.PropertyChangeListener pcl)
pcl
- The class to remove as a property change listener.public final void addListener(ConfigurationKey key, java.beans.PropertyChangeListener pcl)
key
- The specific key to listen for.pcl
- The class which will listen for property changes.public final void removeListener(ConfigurationKey key, java.beans.PropertyChangeListener pcl)
key
- The specific key being listened for.pcl
- The class to remove as a property change listener.public boolean hasKey(ConfigurationKey key)
key
- the property being checked.
public abstract java.lang.String getValue(java.lang.String key, java.lang.String defaultValue)
key
- the configuration key to return.defaultValue
- the configuration key to return.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2003 (20030919) | ArgoUML Project Home | ArgoUML Cookbook |