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

java.lang.Object
  extended byorg.apache.turbine.services.intake.validator.DefaultValidator
      extended byorg.apache.turbine.services.intake.validator.NumberValidator
All Implemented Interfaces:
InitableByConstraintMap, Validator
Direct Known Subclasses:
BigDecimalValidator, DoubleValidator, FloatValidator, IntegerValidator, LongValidator, NumberKeyValidator, ShortValidator

abstract 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.8.2.2 2004/05/20 03:06:47 seade Exp $
Author:
John McNally, Quinton McCombs, Colin Chalmers

Field Summary
(package private)  java.lang.String invalidNumberMessage
          The message to use for invalid numbers
(package private)  java.lang.String maxValueMessage
          The message to show if field fails max-value test
(package private)  java.lang.String minValueMessage
          The message to show if field fails min-value test
 
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
(package private) NumberValidator()
           
 
Method Summary
 java.lang.String getInvalidNumberMessage()
          Get the value of invalidNumberMessage.
 java.lang.String getMaxValueMessage()
          Get the value of maxValueMessage.
 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 invalidNumberMessage)
          Set the value of invalidNumberMessage.
 void setMaxValueMessage(java.lang.String maxValueMessage)
          Set the value of maxValueMessage.
 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, 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

java.lang.String minValueMessage
The message to show if field fails min-value test


maxValueMessage

java.lang.String maxValueMessage
The message to show if field fails max-value test


invalidNumberMessage

java.lang.String invalidNumberMessage
The message to use for invalid numbers

Constructor Detail

NumberValidator

NumberValidator()
Method Detail

init

public void init(java.util.Map paramMap)
          throws InvalidMaskException
Extract the relevant parameters from the constraints listed in tags within the intake.xml file.

Specified by:
init in interface InitableByConstraintMap
Overrides:
init in class DefaultValidator
Parameters:
paramMap - a Map of rule's containing constraints on the input.
Throws:
InvalidMaskException - an invalid mask was specified

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-2004 Apache Software Foundation. All Rights Reserved.