com.opensymphony.xwork2.validator.validators
Class DateRangeFieldValidator

java.lang.Object
  extended by com.opensymphony.xwork2.validator.validators.ValidatorSupport
      extended by com.opensymphony.xwork2.validator.validators.FieldValidatorSupport
          extended by com.opensymphony.xwork2.validator.validators.AbstractRangeValidator
              extended by com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator
All Implemented Interfaces:
FieldValidator, ShortCircuitableValidator, Validator

public class DateRangeFieldValidator
extends AbstractRangeValidator

Field Validator that checks if the date supplied is within a specific range. NOTE: If no date converter is specified, XWorkBasicConverter will kick in to do the date conversion, which by default using the Date.SHORT format using the a programmatically specified locale else falling back to the system default locale.

 
    <validators>
                <!-- Plain Validator syntax -->
                <validator type="date">
                <param name="fieldName">birthday</param>
              <param name="min">01/01/1990</param>
              <param name="max">01/01/2000</param>
              <message>Birthday must be within ${min} and ${max}</message>
                </validator>
    
          <!-- Field Validator Syntax -->
          <field name="birthday">
                <field-validator type="date">
                    <param name="min">01/01/1990</param>
                  <param name="max">01/01/2000</param>
                  <message>Birthday must be within ${min} and ${max}</message>
                </field>
          </field>
    
    </validators>
 
 

Version:
$Date: 2009-12-27 19:18:29 +0100 (Sun, 27 Dec 2009) $ $Id: DateRangeFieldValidator.java 894090 2009-12-27 18:18:29Z martinc $
Author:
Jason Carreira

Field Summary
 
Fields inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport
defaultMessage, log, messageKey
 
Constructor Summary
DateRangeFieldValidator()
           
 
Method Summary
 java.util.Date getMax()
           
protected  java.lang.Comparable getMaxComparatorValue()
           
 java.util.Date getMin()
           
protected  java.lang.Comparable getMinComparatorValue()
           
 void setMax(java.util.Date max)
           
 void setMin(java.util.Date min)
           
 
Methods inherited from class com.opensymphony.xwork2.validator.validators.AbstractRangeValidator
validate
 
Methods inherited from class com.opensymphony.xwork2.validator.validators.FieldValidatorSupport
getFieldName, getValidatorType, setFieldName, setValidatorType
 
Methods inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport
addActionError, addFieldError, conditionalParse, getDefaultMessage, getFieldValue, getMessage, getMessageKey, getMessageParameters, getParse, getValidatorContext, isShortCircuit, setDefaultMessage, setMessageKey, setMessageParameters, setParse, setShortCircuit, setValidatorContext, setValueStack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.opensymphony.xwork2.validator.Validator
getDefaultMessage, getMessage, getMessageKey, getMessageParameters, getValidatorContext, setDefaultMessage, setMessageKey, setMessageParameters, setValidatorContext, setValueStack
 

Constructor Detail

DateRangeFieldValidator

public DateRangeFieldValidator()
Method Detail

setMax

public void setMax(java.util.Date max)

getMax

public java.util.Date getMax()

setMin

public void setMin(java.util.Date min)

getMin

public java.util.Date getMin()

getMaxComparatorValue

protected java.lang.Comparable getMaxComparatorValue()
Specified by:
getMaxComparatorValue in class AbstractRangeValidator

getMinComparatorValue

protected java.lang.Comparable getMinComparatorValue()
Specified by:
getMinComparatorValue in class AbstractRangeValidator


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