org.iscreen.validators
Class RegularExpressionValidator
java.lang.Object
org.iscreen.BaseValidator
org.iscreen.validators.RegularExpressionValidator
- All Implemented Interfaces:
- Validator
public class RegularExpressionValidator
- extends BaseValidator
The RegularExpressionValidator uses a regular expression to check
a single String value to ensure that it finds a match.
- Author:
- Shellman, Dan
Method Summary |
java.lang.String |
getRegex()
|
boolean |
isAllowNull()
|
void |
setAllowNull(boolean flag)
|
void |
setRegex(java.lang.String exp)
|
void |
validate(ValidatorContext context,
java.lang.Object beanToValidate)
This is the method that's called to validate the "bean-to-validate."
Use the passed in ValidatorContext to report validation failures, etc. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
regexExp
protected java.util.regex.Pattern regexExp
allowNull
protected boolean allowNull
RegularExpressionValidator
public RegularExpressionValidator()
- Default constructor.
validate
public void validate(ValidatorContext context,
java.lang.Object beanToValidate)
- Description copied from interface:
Validator
- This is the method that's called to validate the "bean-to-validate."
Use the passed in ValidatorContext to report validation failures, etc.
The passed-in "bean-to-validate" is the same instance returned from
the call to constructBeanToValidate(), but with all of the appropriate
properties set (based upon the configured mapping).
- Parameters:
context
- The ValidatorContext, which is used to report failures.beanToValidate
- The JavaBean to validate.
setRegex
public void setRegex(java.lang.String exp)
getRegex
public java.lang.String getRegex()
setAllowNull
public void setAllowNull(boolean flag)
isAllowNull
public boolean isAllowNull()