org.exolab.castor.xml.validators
Class BooleanValidator

java.lang.Object
  extended by org.exolab.castor.xml.validators.PatternValidator
      extended by org.exolab.castor.xml.validators.BooleanValidator
All Implemented Interfaces:
TypeValidator

public class BooleanValidator
extends PatternValidator
implements TypeValidator

The Boolean Validation class. Handles validation for the primitive boolean and java.lang.Boolean types.

Version:
$Revision: 6754 $ $Date: 2003-03-03 02:57:21 -0700 (Mon, 03 Mar 2003) $
Author:
Arnaud Blandin

Nested Class Summary
 
Nested classes/interfaces inherited from class org.exolab.castor.xml.validators.PatternValidator
PatternValidator.DefaultRegExpEvaluator
 
Constructor Summary
BooleanValidator()
          Creates a new BooleanValidator with no restrictions.
 
Method Summary
 void clearFixed()
          Clears the fixed value for this BooleanValidator.
 java.lang.Boolean getFixed()
          Returns the fixed value that booleans validated with this validator must be equal to.
 boolean hasFixed()
          Returns true if a fixed value to validate against has been set.
 void setFixed(boolean fixedValue)
          Sets the fixed value for boolean validation.
 void setFixed(java.lang.Boolean fixedValue)
          Sets the fixed value for boolean validation.
 void validate(boolean b, ValidationContext context)
          Validates the given Object.
 void validate(java.lang.Object object)
          Validates the given Object.
 void validate(java.lang.Object object, ValidationContext context)
          Validates the given Object.
 
Methods inherited from class org.exolab.castor.xml.validators.PatternValidator
addPattern, clearPatterns, getPattern, getPatterns, hasPattern, isNillable, setNillable, setPattern, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanValidator

public BooleanValidator()
Creates a new BooleanValidator with no restrictions.

Method Detail

clearFixed

public void clearFixed()
Clears the fixed value for this BooleanValidator.


getFixed

public java.lang.Boolean 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

public void setFixed(java.lang.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.

validate

public void validate(boolean b,
                     ValidationContext context)
              throws ValidationException
Validates the given Object.

Parameters:
b - the boolean to validate
context - the ValidationContext
Throws:
ValidationException - if the object fails validation.

validate

public void validate(java.lang.Object object)
              throws ValidationException
Validates the given Object.

Parameters:
object - the Object to validate
Throws:
ValidationException - if the object fails validation.

validate

public void validate(java.lang.Object object,
                     ValidationContext context)
              throws ValidationException
Validates the given Object.

Specified by:
validate in interface TypeValidator
Overrides:
validate in class PatternValidator
Parameters:
object - the Object to validate
context - the ValidationContext
Throws:
ValidationException - if the object fails validation.


Intalio Inc. (C) 1999-2007. All rights reserved http://www.intalio.com