org.exolab.castor.xml.validators

Class ByteValidator

Implemented Interfaces:
TypeValidator

public class ByteValidator
extends PatternValidator
implements TypeValidator

The Byte Validation class. This class handles validation for the byte type.
Version:
$Revision: 1.2 $ $Date: 2003/03/03 09:57:21 $
Authors:
Keith Visco
Arnaud Blandin

Nested Class Summary

Nested classes/interfaces inherited from class org.exolab.castor.xml.validators.PatternValidator

PatternValidator.DefaultRegExpEvaluator

Constructor Summary

ByteValidator()
Creates a new ByteValidator with no restrictions

Method Summary

void
clearFixed()
Clears the fixed value for this IntegerValidator
void
clearMax()
Clears the maximum value for this ByteValidator
void
clearMin()
Clears the minimum value for this ByteValidator
Byte
getFixed()
Returns the fixed value that bytes validated with this validator must be equal to.
Byte
getMaxInclusive()
Returns the maximum value that bytes validated with this validator must be equal to or less than.
Byte
getMinInclusive()
Returns the minimum value that bytes validated with this validator must be equal to or greater than.
boolean
hasFixed()
Returns true if a fixed value, to validate against, has been set.
void
setFixed(byte fixedValue)
Sets the fixed value that bytes validated with this validated must be equal to
void
setMaxExclusive(byte maxValue)
Sets the maximum value that bytes validated with this validator must be less than
void
setMaxInclusive(byte maxValue)
Sets the maximum value that bytes validated with this validator are allowed to be
void
setMinExclusive(byte minValue)
Sets the minimum value that bytes validated with this validator must be greater than
void
setMinInclusive(byte minValue)
Sets the minimum value that bytes validated with this validator are allowed to be
void
validate(Object object)
Validates the given Object
void
validate(Object object, ValidationContext context)
Validates the given Object
void
validate(byte b, ValidationContext context)

Methods inherited from class org.exolab.castor.xml.validators.PatternValidator

getPattern, hasPattern, setPattern, validate, validate

Constructor Details

ByteValidator

public ByteValidator()
Creates a new ByteValidator with no restrictions

Method Details

clearFixed

public void clearFixed()
Clears the fixed value for this IntegerValidator

clearMax

public void clearMax()
Clears the maximum value for this ByteValidator

clearMin

public void clearMin()
Clears the minimum value for this ByteValidator

getFixed

public Byte getFixed()
Returns the fixed value that bytes validated with this validator must be equal to. A null value is returned if no fixed value has been specified.
Returns:
the fixed value to validate against.

getMaxInclusive

public Byte getMaxInclusive()
Returns the maximum value that bytes validated with this validator must be equal to or less than. A null value is returned if no maximum value has been specified.
Returns:
the maximum inclusive value to validate against.

getMinInclusive

public Byte getMinInclusive()
Returns the minimum value that bytes validated with this validator must be equal to or greater than. A null value is returned if no minimum value has been specified.
Returns:
the minimum inclusive 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(byte fixedValue)
Sets the fixed value that bytes validated with this validated must be equal to
Parameters:
fixedValue - the fixed value a byte validated with this validator must be equal to.
NOTE: Using Fixed values takes preceedence over using max and mins, and is really the same as setting both max-inclusive and min-inclusive to the same value

setMaxExclusive

public void setMaxExclusive(byte maxValue)
Sets the maximum value that bytes validated with this validator must be less than
Parameters:
maxValue - the maximum value a byte validated with this validator must be less than

setMaxInclusive

public void setMaxInclusive(byte maxValue)
Sets the maximum value that bytes validated with this validator are allowed to be
Parameters:
maxValue - the maximum value a byte validated with this validator may be

setMinExclusive

public void setMinExclusive(byte minValue)
Sets the minimum value that bytes validated with this validator must be greater than
Parameters:
minValue - the minimum value a byte validated with this validator must be greater than

setMinInclusive

public void setMinInclusive(byte minValue)
Sets the minimum value that bytes validated with this validator are allowed to be
Parameters:
minValue - the minimum value a byte validated with this validator may be

validate

public void validate(Object object)
            throws ValidationException
Validates the given Object
Parameters:
object - the Object to validate

validate

public void validate(Object object,
                     ValidationContext context)
            throws ValidationException
Validates the given Object
Specified by:
validate in interface TypeValidator
Overrides:
validate in interface PatternValidator
Parameters:
object - the Object to validate
context - the ValidationContext

validate

public void validate(byte b,
                     ValidationContext context)
            throws ValidationException

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