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

java.lang.Object
  |
  +--org.apache.turbine.services.intake.validator.DefaultValidator
        |
        +--org.apache.turbine.services.intake.validator.NumberValidator
All Implemented Interfaces:
InitableByConstraintMap, Validator
Direct Known Subclasses:
IntegerValidator, NumberKeyValidator

public class NumberValidator
extends DefaultValidator

Validates numbers with the following constraints in addition to those listed in DefaultValidator.
NameValid ValuesDefault Value
minValuegreater than BigDecimal.MIN_VALUE  
maxValueless than BigDecimal.MAX_VALUE  
notANumberMessageSome text Entry was not a valid number

Version:
$Id: NumberValidator.java,v 1.4 2002/07/16 16:10:22 henning Exp $
Author:
Field Summary
protected  java.lang.String invalidNumberMessage
           
protected  java.lang.String maxValueMessage
           
protected  java.lang.String minValueMessage
           
 
Fields inherited from class org.apache.turbine.services.intake.validator.DefaultValidator
mask, maskMessage, maxLength, maxLengthMessage, message, minLength, minLengthMessage, required, requiredMessage
 
Constructor Summary
NumberValidator()
           
NumberValidator(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
protected  void doInit(java.util.Map paramMap)
           
protected  java.lang.String getDefaultInvalidNumberMessage()
           
 java.lang.String getInvalidNumberMessage()
          Get the value of invalidNumberMessage.
 java.math.BigDecimal getMaxValueAsBigDecimal()
          Get the value of maxValue.
 java.lang.String getMaxValueMessage()
          Get the value of maxValueMessage.
 java.math.BigDecimal getMinValueAsBigDecimal()
          Get the value of minValue.
 java.lang.String getMinValueMessage()
          Get the value of minValueMessage.
 void init(java.util.Map paramMap)
          Extract the relevant parameters from the constraints listed in tags within the intake.xml file.
 void setInvalidNumberMessage(java.lang.String v)
          Set the value of invalidNumberMessage.
 void setMaxValue(java.math.BigDecimal v)
          Set the value of maxValue.
 void setMaxValueMessage(java.lang.String v)
          Set the value of maxValueMessage.
 void setMinValue(java.math.BigDecimal v)
          Set the value of minValue.
 void setMinValueMessage(java.lang.String v)
          Set the value of minValueMessage.
 
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
 

Field Detail

minValueMessage

protected java.lang.String minValueMessage

maxValueMessage

protected java.lang.String maxValueMessage

invalidNumberMessage

protected java.lang.String invalidNumberMessage
Constructor Detail

NumberValidator

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

NumberValidator

public NumberValidator()
Method Detail

init

public void init(java.util.Map paramMap)
          throws TurbineException
Extract the relevant parameters from the constraints listed in tags within the intake.xml file.
Overrides:
init in class DefaultValidator
Parameters:
inputParameters - a Map of InputParam's containing constraints on the input.
Throws:
TurbineException - if an error occurs

doInit

protected void doInit(java.util.Map paramMap)

getDefaultInvalidNumberMessage

protected java.lang.String getDefaultInvalidNumberMessage()

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.

getMinValueAsBigDecimal

public java.math.BigDecimal getMinValueAsBigDecimal()
Get the value of minValue.
Returns:
value of minValue.

setMinValue

public void setMinValue(java.math.BigDecimal v)
Set the value of minValue.
Parameters:
v - Value to assign to minValue.

getMinValueMessage

public java.lang.String getMinValueMessage()
Get the value of minValueMessage.
Returns:
value of minValueMessage.

setMinValueMessage

public void setMinValueMessage(java.lang.String v)
Set the value of minValueMessage.
Parameters:
v - Value to assign to minValueMessage.

getMaxValueAsBigDecimal

public java.math.BigDecimal getMaxValueAsBigDecimal()
Get the value of maxValue.
Returns:
value of maxValue.

setMaxValue

public void setMaxValue(java.math.BigDecimal v)
Set the value of maxValue.
Parameters:
v - Value to assign to maxValue.

getMaxValueMessage

public java.lang.String getMaxValueMessage()
Get the value of maxValueMessage.
Returns:
value of maxValueMessage.

setMaxValueMessage

public void setMaxValueMessage(java.lang.String v)
Set the value of maxValueMessage.
Parameters:
v - Value to assign to maxValueMessage.

getInvalidNumberMessage

public java.lang.String getInvalidNumberMessage()
Get the value of invalidNumberMessage.
Returns:
value of invalidNumberMessage.

setInvalidNumberMessage

public void setInvalidNumberMessage(java.lang.String v)
Set the value of invalidNumberMessage.
Parameters:
v - Value to assign to invalidNumberMessage.


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