Class StringValidator
- java.lang.Object
- 
- org.apache.fulcrum.intake.validator.DefaultValidator<String>
- 
- org.apache.fulcrum.intake.validator.StringValidator
 
 
- 
- All Implemented Interfaces:
- org.apache.avalon.framework.logger.LogEnabled,- InitableByConstraintMap,- Validator<String>
 
 public class StringValidator extends DefaultValidator<String> A validator that will compare a testValue against the following constraints:
 This validator can serve as the base class for more specific validatorsValidation rules Name Valid Values Default Value required true|false false mask regexp minLength integer 0 maxLength integer - Version:
- $Id$
- Author:
- John McNally, Quinton McCombs, Colin Chalmers, Jürgen Hoffmann, Thomas Vandahl
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected StringmaskMessageThe message to report if the mask constraint is not satisfiedprotected PatternmaskPatternThe compiled Regular Expressionprotected StringmaskStringThe matching mask String as supplied by the XML input- 
Fields inherited from class org.apache.fulcrum.intake.validator.DefaultValidatorerrorMessage, log, maxLength, maxLengthMessage, minLength, minLengthMessage, required, requiredMessage
 - 
Fields inherited from interface org.apache.fulcrum.intake.validator.ValidatorFLEXIBLE_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 SummaryConstructors Constructor Description StringValidator()Default constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassertValidity(String testValue)Determine whether a testValue meets the criteria specified in the constraints defined for this validatorStringgetMask()Get the value of mask.StringgetMaskMessage()Get the value of maskMessage.voidinit(Map<String,? extends Constraint> paramMap)Extract the relevant parameters from the constraints listed in <rule> tags within the intake.xml file.voidsetMask(String mask)Set the value of mask.voidsetMaskMessage(String message)Set the value of maskMessage.- 
Methods inherited from class org.apache.fulcrum.intake.validator.DefaultValidatorassertValidity, enableLogging, getMaxLength, getMaxLengthMessage, getMessage, getMinLength, getMinLengthMessage, getRequiredMessage, isRequired, isValid, isValid, setMaxLength, setMaxLengthMessage, setMinLength, setMinLengthMessage, setRequired, setRequiredMessage
 
- 
 
- 
- 
- 
Field Detail- 
maskStringprotected String maskString The matching mask String as supplied by the XML input
 - 
maskPatternprotected Pattern maskPattern The compiled Regular Expression
 - 
maskMessageprotected String maskMessage The message to report if the mask constraint is not satisfied
 
- 
 - 
Constructor Detail- 
StringValidatorpublic StringValidator() Default constructor
 
- 
 - 
Method Detail- 
initpublic void init(Map<String,? extends Constraint> paramMap) throws InvalidMaskException Extract the relevant parameters from the constraints listed in <rule> tags within the intake.xml file.- Specified by:
- initin interface- InitableByConstraintMap
- Overrides:
- initin class- DefaultValidator<String>
- Parameters:
- paramMap- a- Mapof- Rule's containing constraints on the input.
- Throws:
- InvalidMaskException- An invalid mask was specified for one of the rules
 
 - 
assertValiditypublic void assertValidity(String testValue) throws ValidationException Determine whether a testValue meets the criteria specified in the constraints defined for this validator- Specified by:
- assertValidityin interface- Validator<String>
- Overrides:
- assertValidityin class- DefaultValidator<String>
- Parameters:
- testValue- a- Stringto be tested
- Throws:
- ValidationException- containing an error message if the testValue did not pass the validation tests.
 
 - 
setMaskpublic void setMask(String mask) throws InvalidMaskException Set the value of mask.- Parameters:
- mask- Value to assign to mask.
- Throws:
- InvalidMaskException- the mask could not be compiled.
 
 - 
getMaskMessagepublic String getMaskMessage() Get the value of maskMessage.- Returns:
- value of maskMessage.
 
 - 
setMaskMessagepublic void setMaskMessage(String message) Set the value of maskMessage.- Parameters:
- message- Value to assign to maskMessage.
 
 
- 
 
-