ca.bc.gov.webade.validation
Class PreferenceValidator

java.lang.Object
  extended byca.bc.gov.webade.validation.PreferenceValidator
Direct Known Subclasses:
NumberPreferenceValidator, StringPreferenceValidator

public abstract class PreferenceValidator
extends java.lang.Object

Author:
jross

Constructor Summary
PreferenceValidator()
           
 
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.
 java.util.HashMap getDependantPreferences()
           
 int getMaxOccurrenceCount()
           
 int getMinOccurrenceCount()
           
 void setMaxOccurrenceCount(int maxOccurrenceCount)
           
 void setMinOccurrenceCount(int minOccurrenceCount)
           
 void validate(Preference pref)
          Validates the given preference according to the preference value rules.
abstract  void validateValue(java.lang.String value)
          Validates the given Preference value, and throws an exception if validation fails.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferenceValidator

public PreferenceValidator()
Method Detail

validate

public void validate(Preference pref)
              throws ConfigurationException
Validates the given preference according to the preference value rules.

Parameters:
pref - The target pref to validate.
Throws:
ConfigurationException - Thrown if a validation error occurs.

validateValue

public abstract void validateValue(java.lang.String value)
                            throws ConfigurationException
Validates the given Preference value, and throws an exception if validation fails.

Parameters:
value - The preference value to validate.
Throws:
ConfigurationException - Thrown if validation fails.

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.