org.barracudamvc.contrib.sam.data
Class RegexValidator
java.lang.Object
org.barracudamvc.core.forms.AbstractFormValidator
org.barracudamvc.core.forms.DefaultFormValidator
org.barracudamvc.contrib.sam.data.RegexValidator
- All Implemented Interfaces:
- FormValidator
- public class RegexValidator
- extends DefaultFormValidator
This validator ensures that a value matches a given regexp.
For compatibility with JDK 1.3, all references to java.util.regex are replaced by gnu.regexp
Field Summary |
protected gnu.regexp.RE |
re
|
Method Summary |
void |
validateFormElement(Object val,
FormElement element,
boolean deferExceptions)
Validate a FormElement to make sure a given pattern is matched
Validation is only supported for FormType.STRING |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
re
protected gnu.regexp.RE re
RegexValidator
public RegexValidator(gnu.regexp.RE re)
- Public constructor.
- Parameters:
re
- Pattern to be matched
RegexValidator
public RegexValidator(gnu.regexp.RE re,
String ierrmsg)
- Public constructor.
- Parameters:
re
- Pattern to be matchedierrmsg
- the message associated with this error
validateFormElement
public void validateFormElement(Object val,
FormElement element,
boolean deferExceptions)
throws ValidationException
- Validate a FormElement to make sure a given pattern is matched
Validation is only supported for FormType.STRING
- Overrides:
validateFormElement
in class DefaultFormValidator
- Parameters:
element
- the form element to be validateddeferExceptions
- do we want to deferValidation exceptions
and attempt to validate all elements so that we can process
all the exceptions at onceval
- the actual value to be validated
- Throws:
ValidationException
- if the element is not valid
Copyright © 2004 BarracudaMVC.org All Rights Reserved.