com.opensymphony.xwork2.validator.validators
Class DoubleRangeFieldValidator

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.DoubleRangeFieldValidator
All Implemented Interfaces:
FieldValidator, ShortCircuitableValidator, Validator

public class DoubleRangeFieldValidator
extends FieldValidatorSupport

Field Validator that checks if the double specified is within a certain range.

 
                 <validators>
           <!-- Plain Validator Syntax -->
           <validator type="double">
               <param name="fieldName">percentage</param>
               <param name="minInclusive">20.1</param>
               <param name="maxInclusive">50.1</param>
               <message>Age needs to be between ${minInclusive} and
${maxInclusive} (inclusive)</message>
           </validator>

           <!-- Field Validator Syntax -->
           <field name="percentage">
               <field-validator type="double">
                   <param name="minExclusive">0.123</param>
                   <param name="maxExclusive">99.98</param>
                   <message>Percentage needs to be between ${minExclusive}
and ${maxExclusive} (exclusive)</message>
               </field-validator>
           </field>
      </validators>
 
 

Version:
$Id: DoubleRangeFieldValidator.java 894090 2009-12-27 18:18:29Z martinc $
Author:
Rainer Hermanns, Rene Gielen

Field Summary
 
Fields inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport
defaultMessage, log, messageKey
 
Constructor Summary
DoubleRangeFieldValidator()
           
 
Method Summary
 java.lang.String getMaxExclusive()
           
 java.lang.String getMaxInclusive()
           
 java.lang.String getMinExclusive()
           
 java.lang.String getMinInclusive()
           
 void setMaxExclusive(java.lang.String maxExclusive)
           
 void setMaxInclusive(java.lang.String maxInclusive)
           
 void setMinExclusive(java.lang.String minExclusive)
           
 void setMinInclusive(java.lang.String minInclusive)
           
 void validate(java.lang.Object object)
          The validation implementation must guarantee that setValidatorContext will be called with a non-null ValidatorContext before validate is called.
 
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

DoubleRangeFieldValidator

public DoubleRangeFieldValidator()
Method Detail

validate

public void validate(java.lang.Object object)
              throws ValidationException
Description copied from interface: Validator
The validation implementation must guarantee that setValidatorContext will be called with a non-null ValidatorContext before validate is called.

Parameters:
object - the object to be validated.
Throws:
ValidationException - is thrown if there is validation error(s).

setMaxInclusive

public void setMaxInclusive(java.lang.String maxInclusive)

getMaxInclusive

public java.lang.String getMaxInclusive()

setMinInclusive

public void setMinInclusive(java.lang.String minInclusive)

getMinInclusive

public java.lang.String getMinInclusive()

getMinExclusive

public java.lang.String getMinExclusive()

setMinExclusive

public void setMinExclusive(java.lang.String minExclusive)

getMaxExclusive

public java.lang.String getMaxExclusive()

setMaxExclusive

public void setMaxExclusive(java.lang.String maxExclusive)


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