org.apache.turbine.services.intake.validator
Class DateStringValidator

java.lang.Object
  |
  +--org.apache.turbine.services.intake.validator.DefaultValidator
        |
        +--org.apache.turbine.services.intake.validator.DateStringValidator
All Implemented Interfaces:
InitableByConstraintMap, Validator

public class DateStringValidator
extends DefaultValidator

Validates numbers with the following constraints in addition to those listed in DefaultValidator.
NameValid ValuesDefault Value
formatsee SimpleDateFormat javadoc  
formatxsee SimpleDateFormat javadoc  
where x is >= 0 to specify multiple date formats. Only one format rule should have a message
flexibletrue, as long as DateFormat can parse the date, allow it, and false false

Version:
$Id: DateStringValidator.java,v 1.1 2002/07/11 13:21:40 mpoeschl Exp $
Author:
Fields inherited from class org.apache.turbine.services.intake.validator.DefaultValidator
mask, maskMessage, maxLength, maxLengthMessage, message, minLength, minLengthMessage, required, requiredMessage
 
Constructor Summary
DateStringValidator()
           
DateStringValidator(java.util.Map paramMap)
           
 
Method Summary
protected  void doAssertValidity(java.lang.String testValue)
          Determine whether a testValue meets the criteria specified in the constraints defined for this validator
 java.lang.String getDateFormatMessage()
          Get the value of minLengthMessage.
 java.util.List getDateFormats()
          Get the value of dateFormats.
 void init(java.util.Map paramMap)
          Extract the relevant parameters from the constraints listed in tags within the intake.xml file.
 boolean isFlexible()
          Get the value of flexible.
 java.util.Date parse(java.lang.String s)
          Parses the String s according to the rules/formats for this validator.
 void setDateFormatMessage(java.lang.String v)
          Only sets the message if the new message has some information.
 void setDateFormats(java.util.List v)
          Set the value of dateFormats.
 void setFlexible(boolean v)
          Set the value of flexible.
 
Methods inherited from class org.apache.turbine.services.intake.validator.DefaultValidator
assertValidity, getMask, getMaskMessage, getMaxLength, getMaxLengthMessage, getMessage, getMinLength, getMinLengthMessage, getRequiredMessage, isRequired, isValid, setMask, setMaskMessage, setMaxLength, setMaxLengthMessage, setMinLength, setMinLengthMessage, setRequired, setRequiredMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateStringValidator

public DateStringValidator(java.util.Map paramMap)
                    throws TurbineException

DateStringValidator

public DateStringValidator()
Method Detail

init

public void init(java.util.Map paramMap)
          throws TurbineException
Description copied from class: DefaultValidator
Extract the relevant parameters from the constraints listed in tags within the intake.xml file.
Overrides:
init in class DefaultValidator
Following copied from class: org.apache.turbine.services.intake.validator.DefaultValidator
Parameters:
paramMap - a Map of Rule's containing constraints on the input.
Throws:
TurbineException - if an error occurs

doAssertValidity

protected void doAssertValidity(java.lang.String testValue)
                         throws ValidationException
Determine whether a testValue meets the criteria specified in the constraints defined for this validator
Overrides:
doAssertValidity in class DefaultValidator
Parameters:
testValue - a String to be tested
Throws:
ValidationException - containing an error message if the testValue did not pass the validation tests.

parse

public java.util.Date parse(java.lang.String s)
                     throws java.text.ParseException
Parses the String s according to the rules/formats for this validator.

getDateFormatMessage

public java.lang.String getDateFormatMessage()
Get the value of minLengthMessage.
Returns:
value of minLengthMessage.

setDateFormatMessage

public void setDateFormatMessage(java.lang.String v)
Only sets the message if the new message has some information. So the last setMessage call with valid data wins. But later calls with null or empty string will not affect a previous valid setting.
Parameters:
v - Value to assign to minLengthMessage.

getDateFormats

public java.util.List getDateFormats()
Get the value of dateFormats.
Returns:
value of dateFormats.

setDateFormats

public void setDateFormats(java.util.List v)
Set the value of dateFormats.
Parameters:
v - Value to assign to dateFormats.

isFlexible

public boolean isFlexible()
Get the value of flexible.
Returns:
value of flexible.

setFlexible

public void setFlexible(boolean v)
Set the value of flexible.
Parameters:
v - Value to assign to flexible.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.