ca.bc.gov.webade
Class PreferenceSet

java.lang.Object
  extended byca.bc.gov.webade.AbstractPreference
      extended byca.bc.gov.webade.PreferenceSet
All Implemented Interfaces:
java.io.Serializable

public final class PreferenceSet
extends AbstractPreference
implements java.io.Serializable

Author:
jross
See Also:
Serialized Form

Constructor Summary
PreferenceSet(PreferenceSet prefSet)
          Clone Constructor.
PreferenceSet(java.lang.String name)
          Creates a new preference set with the given set name.
 
Method Summary
 void addPreference(Preference pref)
          Adds the given preference to the current set.
static PreferenceSet convertToPreferenceSet(WebADEPreferenceSet prefs)
          Converts the given WebADEPreferenceSet to a PreferenceSet, with a null type and sub-type.
static PreferenceSet convertToPreferenceSet(WebADEPreferenceType prefType, java.lang.String prefSubType, WebADEPreferenceSet prefs)
          Converts the given WebADEPreferenceSet to a PreferenceSet, with the given type and sub-type.
static WebADEPreferenceSet convertToWebADEPreferenceSet(PreferenceSet prefSet)
           
 boolean equals(java.lang.Object obj)
           
 Preference getPreference(java.lang.String preferenceName)
          Returns the corresponding value for the given preference name, or null if not found.
 java.util.Iterator getPreferenceNames()
          Returns the preference names of the preference set.
 java.lang.String getPreferenceSetName()
           
 java.util.Properties getPreferencesProperties()
          Returns all preferences in the set as name value pairs in a Properties object.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class ca.bc.gov.webade.AbstractPreference
getApplicationCode, getEuserId, getPreferenceSubType, getPreferenceType, setPreferenceSubType, setPreferenceType
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PreferenceSet

public PreferenceSet(java.lang.String name)
Creates a new preference set with the given set name.

Parameters:
name - The name of the preference set.

PreferenceSet

public PreferenceSet(PreferenceSet prefSet)
Clone Constructor.

Parameters:
prefSet - The preference set to clone.
Method Detail

convertToPreferenceSet

public static final PreferenceSet convertToPreferenceSet(WebADEPreferenceSet prefs)
Converts the given WebADEPreferenceSet to a PreferenceSet, with a null type and sub-type.

Parameters:
prefs - The WebADEPreferences object to convert.
Returns:
The Preferences object.

convertToPreferenceSet

public static final PreferenceSet convertToPreferenceSet(WebADEPreferenceType prefType,
                                                         java.lang.String prefSubType,
                                                         WebADEPreferenceSet prefs)
Converts the given WebADEPreferenceSet to a PreferenceSet, with the given type and sub-type.

Parameters:
prefType - The target preference type.
prefSubType - The target preference sub type.
prefs - The WebADEPreferences object to convert.
Returns:
The Preferences object.

convertToWebADEPreferenceSet

public static final WebADEPreferenceSet convertToWebADEPreferenceSet(PreferenceSet prefSet)
Parameters:
prefSet - The Preferences object to convert.
Returns:
The WebADEPreferences object.

getPreferenceSetName

public java.lang.String getPreferenceSetName()
Returns:
Returns the name.

getPreferenceNames

public java.util.Iterator getPreferenceNames()
Returns the preference names of the preference set.

Returns:
An Iterator of String objects.

getPreference

public Preference getPreference(java.lang.String preferenceName)
Returns the corresponding value for the given preference name, or null if not found.

Parameters:
preferenceName - The unique name of the target preference in the set.
Returns:
A String value.

getPreferencesProperties

public java.util.Properties getPreferencesProperties()
                                              throws WebADEException
Returns all preferences in the set as name value pairs in a Properties object. Assumes that all preference objects in the set have at most one value assigned.

Returns:
A Properties object of String name-value pairs.
Throws:
WebADEException - Thrown if any of the Preference object within the set have more than one value assigned.

addPreference

public final void addPreference(Preference pref)
Adds the given preference to the current set.

Parameters:
pref - The target preference.

equals

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

toString

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

hashCode

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