Klasse StringValidator
java.lang.Object
org.apache.fulcrum.intake.validator.DefaultValidator<String>
org.apache.fulcrum.intake.validator.StringValidator
- Alle implementierten Schnittstellen:
org.apache.avalon.framework.logger.LogEnabled,InitableByConstraintMap,Validator<String>
A validator that will compare a testValue against the following
constraints:
This validator can serve as the base class for more specific validators
| Name | Valid Values | Default Value |
|---|---|---|
| required | true|false | false |
| mask | regexp | |
| minLength | integer | 0 |
| maxLength | integer |
- Version:
- $Id$
- Autor:
- John McNally, Quinton McCombs, Colin Chalmers, Jürgen Hoffmann, Thomas Vandahl
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected StringThe message to report if the mask constraint is not satisfiedprotected PatternThe compiled Regular Expressionprotected StringThe matching mask String as supplied by the XML inputVon Klasse geerbte Felder org.apache.fulcrum.intake.validator.DefaultValidator
errorMessage, log, maxLength, maxLengthMessage, minLength, minLengthMessage, required, requiredMessageVon Schnittstelle geerbte Felder 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 -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidassertValidity(String testValue) Determine whether a testValue meets the criteria specified in the constraints defined for this validatorgetMask()Get the value of mask.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.voidSet the value of mask.voidsetMaskMessage(String message) Set the value of maskMessage.Von Klasse geerbte Methoden org.apache.fulcrum.intake.validator.DefaultValidator
assertValidity, enableLogging, getMaxLength, getMaxLengthMessage, getMessage, getMinLength, getMinLengthMessage, getRequiredMessage, isRequired, isValid, isValid, setMaxLength, setMaxLengthMessage, setMinLength, setMinLengthMessage, setRequired, setRequiredMessage
-
Felddetails
-
maskString
The matching mask String as supplied by the XML input -
maskPattern
The compiled Regular Expression -
maskMessage
The message to report if the mask constraint is not satisfied
-
-
Konstruktordetails
-
StringValidator
public StringValidator()Default constructor
-
-
Methodendetails
-
init
Extract the relevant parameters from the constraints listed in <rule> tags within the intake.xml file.- Angegeben von:
initin SchnittstelleInitableByConstraintMap- Setzt außer Kraft:
initin KlasseDefaultValidator<String>- Parameter:
paramMap- aMapofRule's containing constraints on the input.- Löst aus:
InvalidMaskException- An invalid mask was specified for one of the rules
-
assertValidity
Determine whether a testValue meets the criteria specified in the constraints defined for this validator- Angegeben von:
assertValidityin SchnittstelleValidator<String>- Setzt außer Kraft:
assertValidityin KlasseDefaultValidator<String>- Parameter:
testValue- aStringto be tested- Löst aus:
ValidationException- containing an error message if the testValue did not pass the validation tests.
-
getMask
Get the value of mask.- Gibt zurück:
- value of mask.
-
setMask
Set the value of mask.- Parameter:
mask- Value to assign to mask.- Löst aus:
InvalidMaskException- the mask could not be compiled.
-
getMaskMessage
Get the value of maskMessage.- Gibt zurück:
- value of maskMessage.
-
setMaskMessage
Set the value of maskMessage.- Parameter:
message- Value to assign to maskMessage.
-