Class BooleanValidator
java.lang.Object
org.exolab.castor.xml.validators.PatternValidator
org.exolab.castor.xml.validators.BooleanValidator
- All Implemented Interfaces:
TypeValidator
The Boolean Validation class. Handles validation for the primitive boolean
and java.lang.Boolean types.
- Version:
- $Revision: 7939 $ $Date: 2003-03-03 02:57:21 -0700 (Mon, 03 Mar 2003) $
- Author:
- Arnaud Blandin
-
Field Summary
Fields inherited from class PatternValidator
resourceBundle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the fixed value for this BooleanValidator.getFixed()Returns the fixed value that booleans validated with this validator must be equal to.booleanhasFixed()Returns true if a fixed value to validate against has been set.voidsetFixed(boolean fixedValue) Sets the fixed value for boolean validation.voidSets the fixed value for boolean validation.voidvalidate(boolean b, ValidationContext context) Validates the given Object.voidValidates the given Object.voidvalidate(Object object, ValidationContext context) Validates the given Object.Methods inherited from class PatternValidator
addPattern, clearPatterns, getPatterns, hasPattern, isNillable, setNillable, validateModifier and TypeMethodDescriptionvoidaddPattern(String pattern) Sets the regular expression to validate against.voidClear all configured patterns.Returns the collection of regular expression patterns.booleanReturns true if a regular expression has been set for this PatternValidator.booleanReturns whether or not objects validated by this Validator are nillable (are allowed to be null).voidsetNillable(boolean nillable) Sets whether or not objects validated by this Validator are allowed to be null (nillable).voidvalidate(String str, ValidationContext context) Validates the given String against the regular expression pattern of this PatternValidator.
-
Constructor Details
-
BooleanValidator
public BooleanValidator()Creates a new BooleanValidator with no restrictions.
-
-
Method Details
-
clearFixed
public void clearFixed()Clears the fixed value for this BooleanValidator. -
getFixed
Returns the fixed value that booleans validated with this validator must be equal to. If no fixed value has been specified, returns null.- Returns:
- the fixed value to validate against.
-
hasFixed
public boolean hasFixed()Returns true if a fixed value to validate against has been set.- Returns:
- true if a fixed value has been set.
-
setFixed
public void setFixed(boolean fixedValue) Sets the fixed value for boolean validation.- Parameters:
fixedValue- the fixed value that a boolean validated with this validator must be equal to.
-
setFixed
Sets the fixed value for boolean validation.- Parameters:
fixedValue- the fixed value that a boolean validated with this validator must be equal to.
-
validate
Validates the given Object.- Parameters:
b- the boolean to validatecontext- the ValidationContext- Throws:
ValidationException- if the object fails validation.
-
validate
Validates the given Object.- Parameters:
object- the Object to validate- Throws:
ValidationException- if the object fails validation.
-
validate
Validates the given Object.- Specified by:
validatein interfaceTypeValidator- Overrides:
validatein classPatternValidator- Parameters:
object- the Object to validatecontext- the ValidationContext- Throws:
ValidationException- if the object fails validation.
-