org.pf.settings.impl
Class MultiValueSettingsImpl

java.lang.Object
  extended by org.pf.settings.impl.GenericSettingsImpl
      extended by org.pf.settings.impl.MultiValueSettingsImpl
All Implemented Interfaces:
CaseSensitivity, MultiValueSettings, ReadOnlySettings, Settings

public class MultiValueSettingsImpl
extends GenericSettingsImpl
implements MultiValueSettings

Implementation of the MultiValueSettings interface.

Version:
1.0
Author:
Manfred Duchrow

Field Summary
 
Fields inherited from class org.pf.settings.impl.GenericSettingsImpl
DEFAULT_CATEGORY_NAME
 
Constructor Summary
MultiValueSettingsImpl()
          Initialize the new instance with default values.
MultiValueSettingsImpl(java.lang.String aName)
          Initialize the new instance with a name.
 
Method Summary
 void addValue(java.lang.String keyName, java.lang.String value)
          Adds the value to the given key in the default category.
 void addValue(java.lang.String categoryName, java.lang.String keyName, java.lang.String value)
          Adds the value to the given key in the specified category.
 void addValues(java.lang.String keyName, java.lang.String[] values)
          Adds the values to the given key in the default category.
 void addValues(java.lang.String categoryName, java.lang.String keyName, java.lang.String[] values)
          Adds the values to the given key in the specified category.
 java.lang.String[] getValuesOf(java.lang.String keyName)
          Returns the values that are registered under the given keyName.
 java.lang.String[] getValuesOf(java.lang.String categoryName, java.lang.String keyName)
          Returns the values of keyName in the specified category.
 void removeValue(java.lang.String keyName, java.lang.String value)
          Removes the given value from the setting with the specified key which is looked up in the default category.
 void removeValue(java.lang.String categoryName, java.lang.String keyName, java.lang.String value)
          Removes the given value from the setting with the specified key in the specified category.
 void setValuesOf(java.lang.String keyName, java.lang.String[] values)
          Sets the values of given key in the default category.
 void setValuesOf(java.lang.String categoryName, java.lang.String keyName, java.lang.String[] values)
          Sets the values of given key in the specified category.
 
Methods inherited from class org.pf.settings.impl.GenericSettingsImpl
defaultSettings, getCaseSensitive, getCategoryNames, getDefaults, getKeyNamesOf, getKeyNamesOfDefaultCategory, getName, getSettingsNameOf, getSettingsNameOf, getValueOf, getValueOf, removeCategory, removeDefaultCategory, removeKey, removeKey, setCaseSensitive, setDefaults, setName, setValueOf, setValueOf
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pf.settings.Settings
removeCategory, removeDefaultCategory, removeKey, removeKey, setValueOf, setValueOf
 
Methods inherited from interface org.pf.settings.ReadOnlySettings
getCategoryNames, getDefaults, getKeyNamesOf, getKeyNamesOfDefaultCategory, getName, getSettingsNameOf, getSettingsNameOf, getValueOf, getValueOf, setDefaults, setName
 

Constructor Detail

MultiValueSettingsImpl

public MultiValueSettingsImpl()
Initialize the new instance with default values.


MultiValueSettingsImpl

public MultiValueSettingsImpl(java.lang.String aName)
Initialize the new instance with a name.

Parameters:
aName - The name of the whole settings object
Method Detail

getValuesOf

public java.lang.String[] getValuesOf(java.lang.String categoryName,
                                      java.lang.String keyName)
Returns the values of keyName in the specified category.

Specified by:
getValuesOf in interface MultiValueSettings
Parameters:
categoryName - The name of the category (null means the default category)
keyName - The name of a key inside the category
Returns:
The associated values or null if either the category or the key could not be found

getValuesOf

public java.lang.String[] getValuesOf(java.lang.String keyName)
Returns the values that are registered under the given keyName.

Specified by:
getValuesOf in interface MultiValueSettings
Parameters:
keyName - The name of a key inside the default category
Returns:
The associated values or null if the key could not be found

setValuesOf

public void setValuesOf(java.lang.String categoryName,
                        java.lang.String keyName,
                        java.lang.String[] values)
Sets the values 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 values 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.
values - The values to be assigned to the key

setValuesOf

public void setValuesOf(java.lang.String keyName,
                        java.lang.String[] values)
Sets the values 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 values will be replaced.

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

addValue

public void addValue(java.lang.String categoryName,
                     java.lang.String keyName,
                     java.lang.String value)
Adds the value to the 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 given value will be added to the old values.

Parameters:
categoryName - The name of the category (null means the default category)
keyName - The name of the key the value should be added to.
value - The value to be added to the key's current values

addValue

public void addValue(java.lang.String keyName,
                     java.lang.String value)
Adds the value to the 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 given value will be added to the old values.
This method does the same as setValueOf().

Parameters:
keyName - The name of the key the value should be added to.
value - The value to be added to the key's current values
See Also:
Settings.setValueOf(String,String)

addValues

public void addValues(java.lang.String categoryName,
                      java.lang.String keyName,
                      java.lang.String[] values)
Adds the values to the 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 new values will be added to the old values.

Parameters:
categoryName - The name of the category (null means the default category)
keyName - The name of the key the value should be added to.
values - The values to be added to the key's current values

addValues

public void addValues(java.lang.String keyName,
                      java.lang.String[] values)
Adds the values to the 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 new values will be added to the old values.

Parameters:
keyName - The name of the key the values should be added to.
values - The values to be added to the key's current values

removeValue

public void removeValue(java.lang.String categoryName,
                        java.lang.String keyName,
                        java.lang.String value)
Removes the given value from the setting with the specified key in the specified category. If the categoryName is null or an empty string the key will be looked up in the default category.

Specified by:
removeValue in interface MultiValueSettings
Parameters:
categoryName - The name of the category the key resides in
keyName - The name of the key from which to remove the value
value - The value to remove

removeValue

public void removeValue(java.lang.String keyName,
                        java.lang.String value)
Removes the given value from the setting with the specified key which is looked up in the default category.

Specified by:
removeValue in interface MultiValueSettings
Parameters:
keyName - The name of the key from which to remove the value
value - The value to remove