org.iscreen.validators
Class RegularExpressionValidator

java.lang.Object
  extended by org.iscreen.BaseValidator
      extended by 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

Field Summary
protected  boolean allowNull
           
protected  java.util.regex.Pattern regexExp
           
 
Fields inherited from class org.iscreen.BaseValidator
defaultFailure
 
Constructor Summary
RegularExpressionValidator()
          Default constructor.
 
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 org.iscreen.BaseValidator
constructBeanToValidate, getDefaultFailure, getStringValue, setDefaultFailure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regexExp

protected java.util.regex.Pattern regexExp

allowNull

protected boolean allowNull
Constructor Detail

RegularExpressionValidator

public RegularExpressionValidator()
Default constructor.

Method Detail

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()