org.exolab.castor.xml.validators

Class DecimalValidator

public class DecimalValidator extends Object implements TypeValidator

The Decimal Validation class. This class handles validation for the Decimal type. TODO : pattern, enumeration

Version: $Revision: 1.4 $ $Date: 2004/10/04 08:42:40 $

Author: Arnaud Blandin

Constructor Summary
DecimalValidator()
Creates a new DecimalValidator with no restrictions
Method Summary
voidclearMax()
Clears the maximum value for this DecimalValidator
voidclearMin()
Clears the minimum value for this DecimalValidator
BigDecimalgetFixed()
Returns the fixed value that decimals validated with this validator must be equal to.
BigDecimalgetMaxInclusive()
Returns the maximum value that decimals validated with this validator must be equal to or less than.
BigDecimalgetMinInclusive()
Returns the minimum value that decimals validated with this validator must be equal to or greater than.
booleanhasFixed()
Returns true if a fixed value, to validate against, has been set.
voidsetFixed(BigDecimal fixed)
Sets the fixed value the decimal to validate must be equal to.
voidsetFractionDigits(int fractionDig)
Sets the fractionDigits facet for this decimal validator.
voidsetMaxExclusive(BigDecimal maxValue)
Sets the maximum value that decimals validated with this validator must be less than
voidsetMaxInclusive(BigDecimal maxValue)
Sets the maximum value that decimals validated with this validator are allowed to be
voidsetMinExclusive(BigDecimal minValue)
Sets the minimum value that decimals validated with this validator must be greater than
voidsetMinInclusive(BigDecimal minValue)
Sets the minimum value that decimals validated with this validator are allowed to be
voidsetTotalDigits(int totalDig)
Sets the totalDigits facet for this decimal validator.
voidvalidate(BigDecimal bd)
voidvalidate(Object object)
Validates the given Object
voidvalidate(Object object, ValidationContext context)
Validates the given Object

Constructor Detail

DecimalValidator

public DecimalValidator()
Creates a new DecimalValidator with no restrictions

Method Detail

clearMax

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

clearMin

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

getFixed

public BigDecimal getFixed()
Returns the fixed value that decimals 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 BigDecimal getMaxInclusive()
Returns the maximum value that decimals 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 BigDecimal getMinInclusive()
Returns the minimum value that decimals 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(BigDecimal fixed)
Sets the fixed value the decimal to validate must be equal to.

Parameters: fixed the fixed value

setFractionDigits

public void setFractionDigits(int fractionDig)
Sets the fractionDigits facet for this decimal validator.

Parameters: fractionDig the value of fractionDigits (must be >=0)

setMaxExclusive

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

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

setMaxInclusive

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

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

setMinExclusive

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

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

setMinInclusive

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

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

setTotalDigits

public void setTotalDigits(int totalDig)
Sets the totalDigits facet for this decimal validator.

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

validate

public void validate(BigDecimal bd)

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