ca.bc.gov.webade.validation
Class PreferenceSetValidator

java.lang.Object
  extended byca.bc.gov.webade.validation.PreferenceSetValidator

public final class PreferenceSetValidator
extends java.lang.Object

Author:
jross

Constructor Summary
PreferenceSetValidator()
           
 
Method Summary
 void addDependantPreference(Preference pref, PreferenceValidator validator)
          Adds the target preference validator to this validator's set.
 void addDependantPreferenceSet(PreferenceSet preferenceSet, PreferenceSetValidator validator)
          Adds the target preference set validator to this validator's set.
 void addPreferenceValidator(Preference pref, PreferenceValidator validator)
          Adds the given validator tied to the target preference to the set of preference validators.
 java.util.HashMap getDependantPreferences()
           
 int getMaxOccurrenceCount()
           
 int getMinOccurrenceCount()
           
 java.util.HashMap getPreferenceValidators()
          Gets the validators tied to the preference set's preferences.
 void setMaxOccurrenceCount(int maxOccurrenceCount)
           
 void setMinOccurrenceCount(int minOccurrenceCount)
           
 void validate(PreferenceSet set, java.util.ArrayList errors, Preferences prefs)
          Validates the given PreferenceSet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferenceSetValidator

public PreferenceSetValidator()
Method Detail

addPreferenceValidator

public void addPreferenceValidator(Preference pref,
                                   PreferenceValidator validator)
Adds the given validator tied to the target preference to the set of preference validators.

Parameters:
pref - The preference the validator is assigned to.
validator - The preference validator.

getPreferenceValidators

public java.util.HashMap getPreferenceValidators()
Gets the validators tied to the preference set's preferences.

Returns:
A HashMap of Preference keys and PreferenceValidtor objects.

validate

public void validate(PreferenceSet set,
                     java.util.ArrayList errors,
                     Preferences prefs)
Validates the given PreferenceSet.

Parameters:
set - The set to validate.
errors -
prefs -

getMaxOccurrenceCount

public int getMaxOccurrenceCount()
Returns:
Returns the maxOccurrenceCount.

setMaxOccurrenceCount

public void setMaxOccurrenceCount(int maxOccurrenceCount)
Parameters:
maxOccurrenceCount - The maxOccurrenceCount to set.

getMinOccurrenceCount

public int getMinOccurrenceCount()
Returns:
Returns the minOccurrenceCount.

setMinOccurrenceCount

public void setMinOccurrenceCount(int minOccurrenceCount)
Parameters:
minOccurrenceCount - The minOccurrenceCount to set.

addDependantPreference

public void addDependantPreference(Preference pref,
                                   PreferenceValidator validator)
Adds the target preference validator to this validator's set. If this preference is defined in the set of preferences, then all dependant validators must also pass validation.

Parameters:
pref - The preference filter.
validator - The preference validator.

addDependantPreferenceSet

public void addDependantPreferenceSet(PreferenceSet preferenceSet,
                                      PreferenceSetValidator validator)
Adds the target preference set validator to this validator's set. If this preference is defined in the set of preferences, then all dependant validators must also pass validation.

Parameters:
preferenceSet - The preference set filter.
validator - The preference set validator.

getDependantPreferences

public java.util.HashMap getDependantPreferences()
Returns:
Returns the dependantPreferences.