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

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

public class BooleanValidator
extends DefaultValidator

Validator for boolean field types.

Values are validated by attemting to match the value to a list of strings for true and false values. The string values are compared without reguard to case.
Valid values for Boolean.TRUE:

Valid values for Boolean.FALSE:

Version:
$Id: BooleanValidator.java 646752 2008-04-10 10:56:15Z tv $
Author:
Quinton McCombs, Colin Chalmers

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
BooleanValidator()
          Default Constructor
BooleanValidator(java.util.Map paramMap)
          Constructor to use when initialising Object
 
Method Summary
 void assertValidity(java.lang.String testValue)
          Determine whether a testValue meets the criteria specified in the constraints defined for this validator
 java.lang.Boolean parse(java.lang.String stringValue)
          Parses a srting value into a Boolean object.
 
Methods inherited from class org.apache.turbine.services.intake.validator.DefaultValidator
assertValidity, getMaxLength, getMaxLengthMessage, getMessage, getMinLength, getMinLengthMessage, getRequiredMessage, init, 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

BooleanValidator

public BooleanValidator()
Default Constructor


BooleanValidator

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

Parameters:
paramMap -
Throws:
InvalidMaskException
Method Detail

assertValidity

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

Specified by:
assertValidity in interface Validator
Overrides:
assertValidity 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.

parse

public java.lang.Boolean parse(java.lang.String stringValue)
                        throws java.text.ParseException
Parses a srting value into a Boolean object.

Parameters:
stringValue - the value to parse
Returns:
a Boolean object
Throws:
java.text.ParseException


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