org.pf.settings
Interface Settings

All Superinterfaces:
ReadOnlySettings
All Known Subinterfaces:
MultiValueSettings
All Known Implementing Classes:
GenericSettingsImpl, MultiValueSettingsImpl, SettingsImpl

public interface Settings
extends ReadOnlySettings

This interface provides read and write access to settings. The structure is, that there is a category with any number of key/value pairs inside. A key is unique in one category but may occur several times in different categories.
If a category of null is passed to any method, the default category will be taken instead. A SettingsWriter must treat the default category as not existent and write all its key/value pairs directly without any category. The default category can be recognized by its empty name ("").

Apart from the interface each implementing class must provide a public default constructor so that instance creation with newInstance() is possible !

Version:
1.2
Author:
Manfred Duchrow

Method Summary
 void removeCategory(java.lang.String categoryName)
          Removes the category with the specified name and all its key/value pairs.
 void removeDefaultCategory()
          Removes the default category and all its key/value pairs.
 void removeKey(java.lang.String keyName)
          Removes the key and its associated value from the default category.
 void removeKey(java.lang.String categoryName, java.lang.String keyName)
          Removes the key and its associated value from the specified category.
 void setValueOf(java.lang.String keyName, java.lang.String value)
          Sets the value of given key in the default category.
 void setValueOf(java.lang.String categoryName, java.lang.String keyName, java.lang.String value)
          Sets the value of given key in the specified category.
 
Methods inherited from interface org.pf.settings.ReadOnlySettings
getCategoryNames, getDefaults, getKeyNamesOf, getKeyNamesOfDefaultCategory, getName, getSettingsNameOf, getSettingsNameOf, getValueOf, getValueOf, setDefaults, setName
 

Method Detail

setValueOf

void setValueOf(java.lang.String categoryName,
                java.lang.String keyName,
                java.lang.String value)
Sets the value of given key in the specified category. If the category does not yet exist, it will be created. If the key does not yet exist, it will be created otherwise the old value will be replaced.

Parameters:
categoryName - The name of the category (null means the default category)
keyName - The name of the key the value should be assigned to.
value - The value to be assigned to the key

setValueOf

void setValueOf(java.lang.String keyName,
                java.lang.String value)
Sets the value of given key in the default category. If the default category does not yet exist, it will be created. If the key does not yet exist, it will be created otherwise the old value will be replaced.

Parameters:
keyName - The name of the key the value should be assigned to.
value - The value to be assigned to the key

removeKey

void removeKey(java.lang.String categoryName,
               java.lang.String keyName)
Removes the key and its associated value from the specified category. If the categoryName is null or an empty string the key/value pair will be removed from the default category.

Parameters:
categoryName - The name of the category the key should be removed from
keyName - The name of the key to remove

removeKey

void removeKey(java.lang.String keyName)
Removes the key and its associated value from the default category.

Parameters:
keyName - The name of the key to remove

removeCategory

void removeCategory(java.lang.String categoryName)
Removes the category with the specified name and all its key/value pairs. If the categoryName is null or an empty string the default category will be removed.

Parameters:
categoryName - The name of the category to removed

removeDefaultCategory

void removeDefaultCategory()
Removes the default category and all its key/value pairs.