org.barracudamvc.core.forms.validators
Class RegularExpressionValidator

java.lang.Object
  extended byorg.barracudamvc.core.forms.AbstractFormValidator
      extended byorg.barracudamvc.core.forms.DefaultFormValidator
          extended byorg.barracudamvc.core.forms.validators.RegularExpressionValidator
All Implemented Interfaces:
FormValidator
Direct Known Subclasses:
DecimalValidator, EmailValidator, IntegerValidator, PhoneValidator, ZipCodeValidator

public class RegularExpressionValidator
extends DefaultFormValidator

A validator for checking a string value against a regular expression pattern.

Since:
csc_110304_1
Author:
christianc@atmreports.com

Field Summary
 
Fields inherited from class org.barracudamvc.core.forms.DefaultFormValidator
localLogger, validators
 
Constructor Summary
RegularExpressionValidator(Pattern ipattern)
           
RegularExpressionValidator(Pattern ipattern, String ierrorMessage)
           
 
Method Summary
 void validateFormElement(Object val, FormElement element, boolean deferExceptions)
          Validate a FormElement.
 
Methods inherited from class org.barracudamvc.core.forms.DefaultFormValidator
addValidator, getValidators, removeValidator, validate, validateForm, validateFormElement
 
Methods inherited from class org.barracudamvc.core.forms.AbstractFormValidator
generateException, getErrorMessage, isNull, setErrorMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegularExpressionValidator

public RegularExpressionValidator(Pattern ipattern)

RegularExpressionValidator

public RegularExpressionValidator(Pattern ipattern,
                                  String ierrorMessage)
Method Detail

validateFormElement

public void validateFormElement(Object val,
                                FormElement element,
                                boolean deferExceptions)
                         throws ValidationException
Description copied from class: DefaultFormValidator
Validate a FormElement. This is the method developers should override to provide specific validation based on the value and (potentially) information contained in the FormElement. To indicate an element is invalid, through a ValidationException, which will interrupt the validation process immediately. If you want to indicate an error, but would still like validation to continue (so that you can identify multiple errors in one validation pass) throw a DeferredValidationException instead.

Overrides:
validateFormElement in class DefaultFormValidator
Parameters:
val - the actual value to be validated
element - the form element that contains the val to validate elements by comparing them with other elements)
deferExceptions - do we want to deferValidation exceptions and attempt to validate all elements so that we can process all the exceptions at once
Throws:
ValidationException - if the element is not valid


Copyright © 2004 BarracudaMVC.org All Rights Reserved.