|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.fulcrum.intake.validator.DefaultValidator
org.apache.fulcrum.intake.validator.StringValidator
public class StringValidator
A validator 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 String |
maskMessage
The message to report if the mask constraint is not satisfied |
protected Pattern |
maskPattern
The compiled Regular Expression |
protected String |
maskString
The matching mask String as supplied by the XML input |
| Fields inherited from class org.apache.fulcrum.intake.validator.DefaultValidator |
|---|
errorMessage, log, maxLength, maxLengthMessage, minLength, minLengthMessage, required, requiredMessage |
| Fields inherited from interface org.apache.fulcrum.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 | |
|---|---|
StringValidator()
Default constructor |
|
StringValidator(Map paramMap)
Constructor |
|
| Method Summary | |
|---|---|
void |
assertValidity(String testValue)
Determine whether a testValue meets the criteria specified in the constraints defined for this validator |
String |
getMask()
Get the value of mask. |
String |
getMaskMessage()
Get the value of maskMessage. |
void |
init(Map paramMap)
Extract the relevant parameters from the constraints listed in |
void |
setMask(String mask)
Set the value of mask. |
void |
setMaskMessage(String message)
Set the value of maskMessage. |
| Methods inherited from class org.apache.fulcrum.intake.validator.DefaultValidator |
|---|
assertValidity, getMaxLength, getMaxLengthMessage, getMessage, getMinLength, getMinLengthMessage, getRequiredMessage, isRequired, isValid, isValid, setMaxLength, setMaxLengthMessage, setMinLength, setMinLengthMessage, setRequired, setRequiredMessage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String maskString
protected Pattern maskPattern
protected String maskMessage
| Constructor Detail |
|---|
public StringValidator(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 StringValidator()
| Method Detail |
|---|
public void init(Map paramMap)
throws InvalidMaskException
init in interface InitableByConstraintMapinit in class DefaultValidatorparamMap - a Map of Rule's
containing constraints on the input.
InvalidMaskException - An invalid mask was specified for one of the rules
public void assertValidity(String testValue)
throws ValidationException
assertValidity in interface ValidatorassertValidity in class DefaultValidatortestValue - a String to be tested
ValidationException - containing an error message if the
testValue did not pass the validation tests.public String getMask()
public void setMask(String mask)
throws InvalidMaskException
mask - Value to assign to mask.
InvalidMaskException - the mask could not be compiled.public String getMaskMessage()
public void setMaskMessage(String message)
message - Value to assign to maskMessage.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||