public class DecimalValidator extends PatternValidator implements TypeValidator
BigDecimal
type.resourceBundle
Constructor and Description |
---|
DecimalValidator()
Creates a new DecimalValidator with no restrictions.
|
Modifier and Type | Method and Description |
---|---|
void |
clearFixed()
Clears the fixed value for this BigIntegerValidator.
|
void |
clearMax()
Clears the maximum value for this DecimalValidator.
|
void |
clearMin()
Clears the minimum value for this DecimalValidator.
|
BigDecimal |
getFixed()
Returns the configured fixed value for BigDecimal validation.
|
BigDecimal |
getMaxExclusive()
Returns the configured exclusive maximum value for BigDecimal validation.
|
BigDecimal |
getMaxInclusive()
Returns the configured inclusive maximum value for BigDecimal validation.
|
BigDecimal |
getMinExclusive()
Returns the configured exclusive minimum value for BigDecimal validation.
|
BigDecimal |
getMinInclusive()
Returns the configured inclusive minimum value for BigDecimal validation.
|
boolean |
hasFixed()
Returns true if a fixed value to validate against has been set.
|
void |
setFixed(BigDecimal fixedValue)
Sets the fixed value for BigDecimal validation.
|
void |
setFractionDigits(int fractionDig)
Sets the maximum number of fraction digits for BigDecimal validation.
|
void |
setMaxExclusive(BigDecimal maxValue)
Sets the maximum (exclusive) value for BigDecimal validation.
|
void |
setMaxInclusive(BigDecimal maxValue)
Sets the maximum (inclusive) value for BigDecimal validation.
|
void |
setMinExclusive(BigDecimal minValue)
Sets the minimum (exclusive) value for BigDecimal validation.
|
void |
setMinInclusive(BigDecimal minValue)
Sets the minimum (inclusive) value for BigDecimal validation.
|
void |
setTotalDigits(int totalDig)
Sets the maximum number of digits for BigDecimal validation.
|
void |
validate(BigDecimal bd,
ValidationContext context)
Validates the given Object.
|
void |
validate(Object object)
Validates the given Object.
|
void |
validate(Object object,
ValidationContext context)
Validates the given Object.
|
addPattern, clearPatterns, getPatterns, hasPattern, isNillable, setNillable, validate
public DecimalValidator()
public void clearFixed()
public void clearMax()
public void clearMin()
public BigDecimal getFixed()
public BigDecimal getMaxInclusive()
public BigDecimal getMaxExclusive()
public BigDecimal getMinInclusive()
public BigDecimal getMinExclusive()
public boolean hasFixed()
public void setFixed(BigDecimal fixedValue)
NOTE: If maximum and/or minimum values have been set and the fixed value is not within that max/min range, then no BigDecimal will pass validation. This is as according to the XML Schema spec.
fixedValue
- the fixed value that a BigDecimal validated with this
validator must be equal to.public void setMinExclusive(BigDecimal minValue)
minValue
- the minimum (exclusive) value for BigDecimal validation.public void setMinInclusive(BigDecimal minValue)
minValue
- the minimum (inclusive) value for BigDecimal validation.public void setMaxExclusive(BigDecimal maxValue)
maxValue
- the maximum (exclusive) value for BigDecimal validation.public void setMaxInclusive(BigDecimal maxValue)
maxValue
- the maximum (inclusive) value for BigDecimal validation.public void setTotalDigits(int totalDig)
totalDig
- the maximum (inclusive) number of digits for BigDecimal
validation. (must be > 0)public void setFractionDigits(int fractionDig)
fractionDig
- the maximum (inclusive) number of fraction digits for
BigDecimal validation. (must be > 0)public void validate(BigDecimal bd, ValidationContext context) throws ValidationException
bd
- the BigDecimal to validatecontext
- the ValidationContextValidationException
- if the object fails validation.public void validate(Object object) throws ValidationException
object
- the Object to validateValidationException
- if the object fails validation.public void validate(Object object, ValidationContext context) throws ValidationException
validate
in interface TypeValidator
validate
in class PatternValidator
object
- the Object to validatecontext
- the ValidationContextValidationException
- if the object fails validation.Copyright © 2021. All rights reserved.