org.exolab.castor.xml.validators

Class IntegerValidator

public class IntegerValidator extends PatternValidator implements TypeValidator

The Integer Validation class. This class handles validation for the integer type as well as all integer derived types such as positive-integer and negative-integer

Version: $Revision: 1.2 $ $Date: 2003/03/03 09:57:21 $

Author: Keith Visco

Constructor Summary
IntegerValidator()
Creates a new IntegerValidator with no restrictions
Method Summary
voidclearFixed()
Clears the fixed value for this IntegerValidator
voidclearMax()
Clears the maximum value for this IntegerValidator
voidclearMin()
Clears the minimum value for this IntegerValidator
IntegergetFixed()
Returns the fixed value that integers validated with this validator must be equal to.
IntegergetMaxInclusive()
Returns the maximum value that integers validated with this validator must be equal to or less than.
IntegergetMinInclusive()
Returns the minimum value that integers validated with this validator must be equal to or greater than.
IntegergetTotalDigits()
Returns the total number of digits that integers validated with this validator must have.
booleanhasFixed()
Returns true if a fixed value, to validate against, has been set.
voidsetFixed(int fixedValue)
Sets the fixed value that integers validated with this validated must be equal to
voidsetFixed(Integer fixedValue)
voidsetMaxExclusive(int maxValue)
Sets the maximum value that integers validated with this validator must be less than
voidsetMaxInclusive(int maxValue)
Sets the maximum value that integers validated with this validator are allowed to be
voidsetMinExclusive(int minValue)
Sets the minimum value that integers validated with this validator must be greater than
voidsetMinInclusive(int minValue)
Sets the minimum value that integers validated with this validator are allowed to be
voidsetTotalDigits(int totalDig)
Sets the totalDigits facet for this Integer type.
voidvalidate(int i, ValidationContext context)
voidvalidate(Object object)
Validates the given Object
voidvalidate(Object object, ValidationContext context)
Validates the given Object

Constructor Detail

IntegerValidator

public IntegerValidator()
Creates a new IntegerValidator with no restrictions

Method Detail

clearFixed

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

clearMax

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

clearMin

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

getFixed

public Integer getFixed()
Returns the fixed value that integers 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 Integer getMaxInclusive()
Returns the maximum value that integers 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 Integer getMinInclusive()
Returns the minimum value that integers 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.

getTotalDigits

public Integer getTotalDigits()
Returns the total number of digits that integers validated with this validator must have. A null value is returned if no total number of digits has been specified.

Returns: the total number of digits

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(int fixedValue)
Sets the fixed value that integers validated with this validated must be equal to

Parameters: fixedValue the fixed value an integer 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

setFixed

public void setFixed(Integer fixedValue)

setMaxExclusive

public void setMaxExclusive(int maxValue)
Sets the maximum value that integers validated with this validator must be less than

Parameters: maxValue the maximum value an integer validated with this validator must be less than

setMaxInclusive

public void setMaxInclusive(int maxValue)
Sets the maximum value that integers validated with this validator are allowed to be

Parameters: maxValue the maximum value an integer validated with this validator may be

setMinExclusive

public void setMinExclusive(int minValue)
Sets the minimum value that integers validated with this validator must be greater than

Parameters: minValue the minimum value an integer validated with this validator must be greater than

setMinInclusive

public void setMinInclusive(int minValue)
Sets the minimum value that integers validated with this validator are allowed to be

Parameters: minValue the minimum value an integer validated with this validator may be

setTotalDigits

public void setTotalDigits(int totalDig)
Sets the totalDigits facet for this Integer type.

Parameters: totalDig the value of totalDigits (must be >0)

validate

public void validate(int i, ValidationContext context)

validate

public void validate(Object object)
Validates the given Object

Parameters: object the Object to validate

validate

public void validate(Object object, ValidationContext context)
Validates the given Object

Parameters: object the Object to validate context the ValidationContext

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