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>

public class StringValidator extends DefaultValidator<String>
A validator that will compare a testValue against the following constraints:
Validation rules
NameValid ValuesDefault Value
requiredtrue|falsefalse
maskregexp 
minLengthinteger0
maxLengthinteger 
This validator can serve as the base class for more specific validators
Version:
$Id$
Autor:
John McNally, Quinton McCombs, Colin Chalmers, Jürgen Hoffmann, Thomas Vandahl
  • Felddetails

    • maskString

      protected String maskString
      The matching mask String as supplied by the XML input
    • maskPattern

      protected Pattern maskPattern
      The compiled Regular Expression
    • maskMessage

      protected String maskMessage
      The message to report if the mask constraint is not satisfied
  • Konstruktordetails

    • StringValidator

      public StringValidator()
      Default constructor
  • Methodendetails

    • init

      public 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.
      Angegeben von:
      init in Schnittstelle InitableByConstraintMap
      Setzt außer Kraft:
      init in Klasse DefaultValidator<String>
      Parameter:
      paramMap - a Map of Rule's containing constraints on the input.
      Löst aus:
      InvalidMaskException - An invalid mask was specified for one of the rules
    • assertValidity

      public void assertValidity(String testValue) throws ValidationException
      Determine whether a testValue meets the criteria specified in the constraints defined for this validator
      Angegeben von:
      assertValidity in Schnittstelle Validator<String>
      Setzt außer Kraft:
      assertValidity in Klasse DefaultValidator<String>
      Parameter:
      testValue - a String to be tested
      Löst aus:
      ValidationException - containing an error message if the testValue did not pass the validation tests.
    • getMask

      public String getMask()
      Get the value of mask.
      Gibt zurück:
      value of mask.
    • setMask

      public void setMask(String mask) throws InvalidMaskException
      Set the value of mask.
      Parameter:
      mask - Value to assign to mask.
      Löst aus:
      InvalidMaskException - the mask could not be compiled.
    • getMaskMessage

      public String getMaskMessage()
      Get the value of maskMessage.
      Gibt zurück:
      value of maskMessage.
    • setMaskMessage

      public void setMaskMessage(String message)
      Set the value of maskMessage.
      Parameter:
      message - Value to assign to maskMessage.