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 1184 2006-11-12 08:30:31 +0100 (Sun, 12 Nov 2006) tm_jee $
Author:
Rainer Hermanns, Rene Gielen

Field Summary
(package private)  String maxExclusive
           
(package private)  Double maxExclusiveValue
           
(package private)  String maxInclusive
           
(package private)  Double maxInclusiveValue
           
(package private)  String minExclusive
           
(package private)  Double minExclusiveValue
           
(package private)  String minInclusive
           
(package private)  Double minInclusiveValue
           
 
Fields inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport
defaultMessage, log, messageKey
 
Constructor Summary
DoubleRangeFieldValidator()
           
 
Method Summary
 String getMaxExclusive()
           
 String getMaxInclusive()
           
 String getMinExclusive()
           
 String getMinInclusive()
           
private  Double parseDouble(String value)
           
private  void parseParameterValues()
           
 void setMaxExclusive(String maxExclusive)
           
 void setMaxInclusive(String maxInclusive)
           
 void setMinExclusive(String minExclusive)
           
 void setMinInclusive(String minInclusive)
           
 void validate(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, getParse, getValidatorContext, isShortCircuit, setDefaultMessage, setMessageKey, 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, getValidatorContext, setDefaultMessage, setMessageKey, setValidatorContext, setValueStack
 

Field Detail

maxInclusive

String maxInclusive

minInclusive

String minInclusive

minExclusive

String minExclusive

maxExclusive

String maxExclusive

maxInclusiveValue

Double maxInclusiveValue

minInclusiveValue

Double minInclusiveValue

minExclusiveValue

Double minExclusiveValue

maxExclusiveValue

Double maxExclusiveValue
Constructor Detail

DoubleRangeFieldValidator

public DoubleRangeFieldValidator()
Method Detail

validate

public void validate(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).

parseParameterValues

private void parseParameterValues()

parseDouble

private Double parseDouble(String value)

setMaxInclusive

public void setMaxInclusive(String maxInclusive)

getMaxInclusive

public String getMaxInclusive()

setMinInclusive

public void setMinInclusive(String minInclusive)

getMinInclusive

public String getMinInclusive()

getMinExclusive

public String getMinExclusive()

setMinExclusive

public void setMinExclusive(String minExclusive)

getMaxExclusive

public String getMaxExclusive()

setMaxExclusive

public void setMaxExclusive(String maxExclusive)


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