Interface NumberConstraint
- All Known Implementing Classes:
BigDecimalConstraint,BigIntegerConstraint,DoubleConstraint,FloatConstraint,LongConstraint
public interface NumberConstraint
Base interface for number type validators which contains all numeric restrictions.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisDecimalMax(BigDecimal max, boolean inclusive) booleanisDecimalMin(BigDecimal min, boolean inclusive) booleanisDigits(int integer, int fraction) booleanisDoubleMax(Double max, boolean inclusive) booleanisDoubleMin(Double min, boolean inclusive) booleanisMax(long max) booleanisMin(long min) booleanbooleanbooleanboolean
-
Method Details
-
isMax
boolean isMax(long max) - Parameters:
max- max value- Returns:
- true if value less than or equal to max
-
isMin
boolean isMin(long min) - Parameters:
min- min value- Returns:
- true if value greater than or equal to min
-
isDigits
boolean isDigits(int integer, int fraction) - Parameters:
integer- value of integer partfraction- value of fraction part- Returns:
- true if value within accepted range
-
isDecimalMax
- Parameters:
max- max valueinclusive- inclusive option, true by default- Returns:
- true if value less than or equal to max (depends on inclusive option)
-
isDecimalMin
- Parameters:
min- min valueinclusive- inclusive option, true by default- Returns:
- true if value less than or equal to min (depends on inclusive option)
-
isNegativeOrZero
boolean isNegativeOrZero()- Returns:
- true if value is less than or equal to 0
-
isNegative
boolean isNegative()- Returns:
- true if value is strictly less than 0
-
isPositiveOrZero
boolean isPositiveOrZero()- Returns:
- true if value is greater than or equal to 0
-
isPositive
boolean isPositive()- Returns:
- true if value is strictly greater than 0
-
isDoubleMax
- Parameters:
max- max valueinclusive- inclusive option, true by default- Returns:
- true if value less than or equal to max (depends on inclusive option)
-
isDoubleMin
- Parameters:
min- min valueinclusive- inclusive option, true by default- Returns:
- true if value less than or equal to min (depends on inclusive option)
-