ca.bc.gov.webade.preferences
Class DefaultMultiValueWebADEPreference

java.lang.Object
  extended byca.bc.gov.webade.preferences.DefaultMultiValueWebADEPreference
All Implemented Interfaces:
MultiValueWebADEPreference, java.io.Serializable, WebADEPreference

public final class DefaultMultiValueWebADEPreference
extends java.lang.Object
implements MultiValueWebADEPreference, java.io.Serializable

Author:
jross
See Also:
Serialized Form

Constructor Summary
DefaultMultiValueWebADEPreference(java.lang.String preferenceName)
          Creates a new preference with the given name.
 
Method Summary
 void addPreferenceValue(java.lang.String preferenceValue)
          Add the given value to the preference.
 void clearPreferenceValues()
          Removes all preference values for this preference, leaving this preference with an empty array of values.
 java.lang.Object clone()
          see java.lang.Object#clone()
 boolean equals(java.lang.Object obj)
           
 java.lang.String getPreferenceName()
           
 java.lang.String getPreferenceValue()
           
 java.util.List getPreferenceValues()
           
 int hashCode()
           
 void removePreferenceValue(java.lang.String preferenceValue)
          Removes the given value from the preference.
 void setPreferenceValue(java.lang.String preferenceValue)
          Sets the given value as the preference value, erasing all other preference values that may already be set for this preference.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultMultiValueWebADEPreference

public DefaultMultiValueWebADEPreference(java.lang.String preferenceName)
Creates a new preference with the given name.

Parameters:
preferenceName - The name of the preference.
Throws:
java.lang.NullPointerException - Thrown if the preference name parameter was null.
Method Detail

getPreferenceName

public final java.lang.String getPreferenceName()
Specified by:
getPreferenceName in interface WebADEPreference
Returns:
Returns the preferenceName.

getPreferenceValue

public final java.lang.String getPreferenceValue()
                                          throws java.lang.IllegalStateException
Specified by:
getPreferenceValue in interface WebADEPreference
Returns:
Returns the preference value assigned to the preference name.
Throws:
java.lang.IllegalStateException - Thrown if the preference contains multiple values.

getPreferenceValues

public final java.util.List getPreferenceValues()
Specified by:
getPreferenceValues in interface MultiValueWebADEPreference
Returns:
Returns the preferenceValues assigned to the preference name.

setPreferenceValue

public final void setPreferenceValue(java.lang.String preferenceValue)
Sets the given value as the preference value, erasing all other preference values that may already be set for this preference.

Specified by:
setPreferenceValue in interface WebADEPreference
Parameters:
preferenceValue - The preference value to set.

addPreferenceValue

public final void addPreferenceValue(java.lang.String preferenceValue)
Add the given value to the preference.

Specified by:
addPreferenceValue in interface MultiValueWebADEPreference
Parameters:
preferenceValue - The preference value to add.

removePreferenceValue

public final void removePreferenceValue(java.lang.String preferenceValue)
Removes the given value from the preference. If the value is not found, no change will occur.

Specified by:
removePreferenceValue in interface MultiValueWebADEPreference
Parameters:
preferenceValue - The preference value to remove.

clearPreferenceValues

public final void clearPreferenceValues()
Removes all preference values for this preference, leaving this preference with an empty array of values.

Specified by:
clearPreferenceValues in interface MultiValueWebADEPreference

equals

public final boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

toString

public final java.lang.String toString()
See Also:
Object.toString()

hashCode

public final int hashCode()
See Also:
Object.hashCode()

clone

public java.lang.Object clone()
see java.lang.Object#clone()

Specified by:
clone in interface WebADEPreference