Class BooleanValidator
java.lang.Object
org.apache.fulcrum.intake.validator.DefaultValidator<Boolean>
org.apache.fulcrum.intake.validator.BooleanValidator
- All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled
,InitableByConstraintMap
,Validator<Boolean>
Validator for boolean field types.
Values are validated by attempting to match the value to a list of strings for true and false values. The string values are compared without regard to case.
Valid values for Boolean.TRUE:
Values are validated by attempting to match the value to a list of strings for true and false values. The string values are compared without regard to case.
Valid values for Boolean.TRUE:
- TRUE
- T
- YES
- Y
- 1
- ON
- FALSE
- F
- NO
- N
- 0
- OFF
- Version:
- $Id$
- Author:
- Quinton McCombs, Colin Chalmers, Jürgen Hoffmann
-
Field Summary
Fields inherited from class org.apache.fulcrum.intake.validator.DefaultValidator
errorMessage, log, maxLength, maxLengthMessage, minLength, minLengthMessage, required, requiredMessage
Fields inherited from interface org.apache.fulcrum.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
assertValidity
(String testValue) Determine whether a testValue meets the criteria specified in the constraints defined for this validatorParses a string value into a Boolean object.Methods inherited from class org.apache.fulcrum.intake.validator.DefaultValidator
assertValidity, enableLogging, getMaxLength, getMaxLengthMessage, getMessage, getMinLength, getMinLengthMessage, getRequiredMessage, init, isRequired, isValid, isValid, setMaxLength, setMaxLengthMessage, setMinLength, setMinLengthMessage, setRequired, setRequiredMessage
-
Constructor Details
-
BooleanValidator
public BooleanValidator()Default Constructor
-
-
Method Details
-
assertValidity
Determine whether a testValue meets the criteria specified in the constraints defined for this validator- Specified by:
assertValidity
in interfaceValidator<Boolean>
- Overrides:
assertValidity
in classDefaultValidator<Boolean>
- Parameters:
testValue
- aString
to be tested- Throws:
ValidationException
- containing an error message if the testValue did not pass the validation tests.
-
parse
Parses a string value into a Boolean object.- Parameters:
stringValue
- the value to parse- Returns:
- a
Boolean
object - Throws:
ParseException
- if the value cannot be parsed to a boolean
-