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

java.lang.Object
  extended byorg.apache.turbine.services.intake.validator.DefaultValidator
      extended byorg.apache.turbine.services.intake.validator.NumberValidator
          extended byorg.apache.turbine.services.intake.validator.BigDecimalValidator
All Implemented Interfaces:
InitableByConstraintMap, Validator

public class BigDecimalValidator
extends org.apache.turbine.services.intake.validator.NumberValidator

Validates BigDecimals with the following constraints in addition to those listed in NumberValidator and DefaultValidator.

NameValid ValuesDefault Value
minValuegreater than BigDecimal minValue  
maxValueless than BigDecimal maxValue  
invalidNumberMessageSome text Entry was not a valid number

Version:
$Id: BigDecimalValidator.java 534527 2007-05-02 16:10:59Z tv $
Author:
John McNally, Colin Chalmers, Jürgen Hoffmann, Thomas Vandahl

Field Summary
 
Fields inherited from class org.apache.turbine.services.intake.validator.DefaultValidator
errorMessage, log, maxLength, maxLengthMessage, minLength, minLengthMessage, required, requiredMessage
 
Fields inherited from interface org.apache.turbine.services.intake.validator.Validator
FLEXIBLE_RULE_NAME, FORMAT_RULE_NAME, INVALID_NUMBER_RULE_NAME, MASK_RULE_NAME, MAX_LENGTH_RULE_NAME, MAX_VALUE_RULE_NAME, MIN_LENGTH_RULE_NAME, MIN_VALUE_RULE_NAME, REQUIRED_RULE_NAME
 
Constructor Summary
BigDecimalValidator()
          Default Constructor
BigDecimalValidator(java.util.Map paramMap)
          Constructor to use when initialising Object
 
Method Summary
 void assertValidity(Field field)
          Determine whether a field meets the criteria specified in the constraints defined for this validator
 void assertValidity(java.lang.String testValue, java.util.Locale locale)
          Determine whether a testValue meets the criteria specified in the constraints defined for this validator
 java.lang.String getInvalidNumberMessage()
          Get the value of invalidNumberMessage.
 java.math.BigDecimal getMaxValue()
          Get the value of maxValue.
 java.lang.String getMaxValueMessage()
          Get the value of maxValueMessage.
 java.math.BigDecimal getMinValue()
          Get the value of minValue.
 java.lang.String getMinValueMessage()
          Get the value of minValueMessage.
 void init(java.util.Map paramMap)
          Method to initialise Object
 void setInvalidNumberMessage(java.lang.String invalidNumberMessage)
          Set the value of invalidNumberMessage.
 void setMaxValue(java.math.BigDecimal maxValue)
          Set the value of maxValue.
 void setMaxValueMessage(java.lang.String maxValueMessage)
          Set the value of maxValueMessage.
 void setMinValue(java.math.BigDecimal minValue)
          Set the value of minValue.
 void setMinValueMessage(java.lang.String minValueMessage)
          Set the value of minValueMessage.
 
Methods inherited from class org.apache.turbine.services.intake.validator.DefaultValidator
assertValidity, getMaxLength, getMaxLengthMessage, getMessage, getMinLength, getMinLengthMessage, getRequiredMessage, isRequired, isValid, isValid, 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

BigDecimalValidator

public BigDecimalValidator(java.util.Map paramMap)
                    throws InvalidMaskException
Constructor to use when initialising Object

Parameters:
paramMap -
Throws:
InvalidMaskException

BigDecimalValidator

public BigDecimalValidator()
Default Constructor

Method Detail

init

public void init(java.util.Map paramMap)
          throws InvalidMaskException
Method to initialise Object

Parameters:
paramMap -
Throws:
InvalidMaskException

assertValidity

public void assertValidity(Field field)
                    throws ValidationException
Determine whether a field meets the criteria specified in the constraints defined for this validator

Specified by:
assertValidity in interface Validator
Overrides:
assertValidity in class DefaultValidator
Parameters:
field - a Field to be tested
Throws:
ValidationException - containing an error message if the testValue did not pass the validation tests.

assertValidity

public void assertValidity(java.lang.String testValue,
                           java.util.Locale locale)
                    throws ValidationException
Determine whether a testValue meets the criteria specified in the constraints defined for this validator

Parameters:
testValue - a String to be tested
locale - the Locale of the associated field
Throws:
ValidationException - containing an error message if the testValue did not pass the validation tests.

getMinValue

public java.math.BigDecimal getMinValue()
Get the value of minValue.

Returns:
value of minValue.

setMinValue

public void setMinValue(java.math.BigDecimal minValue)
Set the value of minValue.

Parameters:
minValue - Value to assign to minValue.

getMaxValue

public java.math.BigDecimal getMaxValue()
Get the value of maxValue.

Returns:
value of maxValue.

setMaxValue

public void setMaxValue(java.math.BigDecimal maxValue)
Set the value of maxValue.

Parameters:
maxValue - Value to assign to maxValue.

getMinValueMessage

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

Returns:
value of minValueMessage.

setMinValueMessage

public void setMinValueMessage(java.lang.String minValueMessage)
Set the value of minValueMessage.

Parameters:
minValueMessage - Value to assign to minValueMessage.

getMaxValueMessage

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

Returns:
value of maxValueMessage.

setMaxValueMessage

public void setMaxValueMessage(java.lang.String maxValueMessage)
Set the value of maxValueMessage.

Parameters:
maxValueMessage - 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 invalidNumberMessage)
Set the value of invalidNumberMessage.

Parameters:
invalidNumberMessage - Value to assign to invalidNumberMessage.


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