|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.turbine.services.intake.validator.DefaultValidator
DefaultValidator that will compare a testValue against the following constraints:
| Name | Valid Values | Default Value |
|---|---|---|
| required | true|false | false |
| mask | regexp | |
| minLength | integer | 0 |
| maxLength | integer |
| Field Summary | |
protected java.lang.String |
errorMessage
Error message pertaining to Rule that was broken |
protected org.apache.commons.logging.Log |
log
Logging |
protected int |
maxLength
The maximum length of the field |
protected java.lang.String |
maxLengthMessage
The message to show if field fails max-length test |
protected int |
minLength
The minimum length of the field |
protected java.lang.String |
minLengthMessage
The message to show if field fails min-length test |
protected boolean |
required
A boolean value to signify if the field is definately required or not |
protected java.lang.String |
requiredMessage
The message to show if field fails required test |
| Fields inherited from interface org.apache.turbine.services.intake.validator.Validator |
FLEXIBLE_RULE_NAME, FORMAT_RULE_NAME, INVALID_NUMBER_RULE_NAME, MASK_RULE_NAME, MAX_LENGTH_RULE_NAME, MAX_VALUE_RULE_NAME, MIN_LENGTH_RULE_NAME, MIN_VALUE_RULE_NAME, REQUIRED_RULE_NAME |
| Constructor Summary | |
DefaultValidator()
Default constructor |
|
DefaultValidator(java.util.Map paramMap)
Constructor |
|
| Method Summary | |
void |
assertValidity(Field field)
Determine whether a field meets the criteria specified in the constraints defined for this validator |
void |
assertValidity(java.lang.String testValue)
Determine whether a testValue meets the criteria specified in the constraints defined for this validator |
int |
getMaxLength()
Get the value of maxLength. |
java.lang.String |
getMaxLengthMessage()
Get the value of maxLengthMessage. |
java.lang.String |
getMessage()
Get the error message resulting from invalid input. |
int |
getMinLength()
Get the value of minLength. |
java.lang.String |
getMinLengthMessage()
Get the value of minLengthMessage. |
java.lang.String |
getRequiredMessage()
Get the value of requiredMessage. |
void |
init(java.util.Map paramMap)
Extract the relevant parameters from the constraints listed in |
boolean |
isRequired()
Get the value of required. |
boolean |
isValid(Field field)
Determine whether a field meets the criteria specified in the constraints defined for this validator |
boolean |
isValid(java.lang.String testValue)
Deprecated. use isValid(Field) instead |
void |
setMaxLength(int maxLength)
Set the value of maxLength. |
void |
setMaxLengthMessage(java.lang.String maxLengthMessage)
Set the value of maxLengthMessage. |
void |
setMinLength(int minLength)
Set the value of minLength. |
void |
setMinLengthMessage(java.lang.String minLengthMessage)
Set the value of minLengthMessage. |
void |
setRequired(boolean required)
Set the value of required. |
void |
setRequiredMessage(java.lang.String requiredMessage)
Set the value of requiredMessage. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean required
protected java.lang.String requiredMessage
protected int minLength
protected java.lang.String minLengthMessage
protected int maxLength
protected java.lang.String maxLengthMessage
protected java.lang.String errorMessage
protected org.apache.commons.logging.Log log
| Constructor Detail |
public DefaultValidator(java.util.Map paramMap)
throws InvalidMaskException
paramMap - a Map of Rule's
containing constraints on the input.
InvalidMaskException - An invalid mask was specified for one of the rulespublic DefaultValidator()
| Method Detail |
public void init(java.util.Map paramMap)
throws InvalidMaskException
init in interface InitableByConstraintMapparamMap - a Map of Rule's
containing constraints on the input.
InvalidMaskException - An invalid mask was specified for one of the rulespublic boolean isValid(Field field)
isValid in interface Validatorfield - a Field to be tested
public void assertValidity(Field field)
throws ValidationException
assertValidity in interface Validatorfield - a Field to be tested
ValidationException - containing an error message if the
testValue did not pass the validation tests.public boolean isValid(java.lang.String testValue)
isValid in interface ValidatortestValue - a String to be tested
public void assertValidity(java.lang.String testValue)
throws ValidationException
assertValidity in interface ValidatortestValue - a String to be tested
ValidationException - containing an error message if the
testValue did not pass the validation tests.public java.lang.String getMessage()
getMessage in interface ValidatorString message, or the empty String "".public boolean isRequired()
public void setRequired(boolean required)
required - Value to assign to required.public java.lang.String getRequiredMessage()
public void setRequiredMessage(java.lang.String requiredMessage)
requiredMessage - Value to assign to requiredMessage.public int getMinLength()
public void setMinLength(int minLength)
minLength - Value to assign to minLength.public java.lang.String getMinLengthMessage()
public void setMinLengthMessage(java.lang.String minLengthMessage)
minLengthMessage - Value to assign to minLengthMessage.public int getMaxLength()
public void setMaxLength(int maxLength)
maxLength - Value to assign to maxLength.public java.lang.String getMaxLengthMessage()
public void setMaxLengthMessage(java.lang.String maxLengthMessage)
maxLengthMessage - Value to assign to maxLengthMessage.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||