org.iscreen.validators
Class StringValidator

java.lang.Object
  extended by org.iscreen.BaseValidator
      extended by org.iscreen.validators.StringValidator
All Implemented Interfaces:
Validator

public class StringValidator
extends BaseValidator

The StringValidator checks the length of the given value.

Author:
Shellman, Dan

Field Summary
protected  java.lang.Integer maxLength
           
protected  FailureMessage maxLengthFailure
           
protected  java.lang.Integer minLength
           
protected  FailureMessage minLengthFailure
           
protected  FailureMessage nullFailure
           
 
Fields inherited from class org.iscreen.BaseValidator
defaultFailure
 
Constructor Summary
StringValidator()
          Default constructor.
 
Method Summary
 java.lang.Integer getMaxLength()
          Retrieves the maximum required length for the string being validated.
 java.lang.Integer getMinLength()
          Retrieves the minimum required length for the string being validated.
 void setMaxLength(java.lang.Integer length)
          Sets the maximum required length for the string being validated.
 void setMaxLengthFailure(FailureMessage failure)
           
 void setMinLength(java.lang.Integer length)
          Sets the minimum required length for the string being validated.
 void setMinLengthFailure(FailureMessage failure)
           
 void setNullFailure(FailureMessage failure)
           
 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, getValue, setDefaultFailure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minLength

protected java.lang.Integer minLength

maxLength

protected java.lang.Integer maxLength

minLengthFailure

protected FailureMessage minLengthFailure

maxLengthFailure

protected FailureMessage maxLengthFailure

nullFailure

protected FailureMessage nullFailure
Constructor Detail

StringValidator

public StringValidator()
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.

setMinLength

public void setMinLength(java.lang.Integer length)
Sets the minimum required length for the string being validated.

Parameters:
length - The minimum required length

getMinLength

public java.lang.Integer getMinLength()
Retrieves the minimum required length for the string being validated.

Returns:
Returns the minimum required length.

setMaxLength

public void setMaxLength(java.lang.Integer length)
Sets the maximum required length for the string being validated.

Parameters:
length - The maximum required length

getMaxLength

public java.lang.Integer getMaxLength()
Retrieves the maximum required length for the string being validated.

Returns:
Returns the maximum required length.

setMinLengthFailure

public void setMinLengthFailure(FailureMessage failure)

setMaxLengthFailure

public void setMaxLengthFailure(FailureMessage failure)

setNullFailure

public void setNullFailure(FailureMessage failure)