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 TypeMethodDescriptionboolean
isDecimalMax
(BigDecimal max, boolean inclusive) boolean
isDecimalMin
(BigDecimal min, boolean inclusive) boolean
isDigits
(int integer, int fraction) boolean
isDoubleMax
(Double max, boolean inclusive) boolean
isDoubleMin
(Double min, boolean inclusive) boolean
isMax
(long max) boolean
isMin
(long min) boolean
boolean
boolean
boolean
-
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)
-