Package org.moeaframework.util.validate
Class IntegerValidator
java.lang.Object
org.moeaframework.util.validate.Validator<T>
org.moeaframework.util.validate.NumberValidator<Integer>
org.moeaframework.util.validate.IntegerValidator
Validator for
int
primitives.-
Constructor Summary
ConstructorDescriptionIntegerValidator
(String propertyName, int propertyValue) Constructs a new validator forint
primitives. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
isBetween
(int lower, int upper) Asserts the value is between the given lower and upper bounds, inclusive.final void
isDivisibleBy
(int divisorValue) Asserts the value is divisible by some divisor.final void
isDivisibleBy
(String divisorName, int divisorValue) Asserts the value is divisible by some divisor.final void
isEqualTo
(int parameterValue) Asserts the value equals some other parameter.final void
Asserts the value equals some other parameter.final void
isGreaterThan
(int thresholdValue) Asserts the value is greater than some threshold.final void
isGreaterThan
(String thresholdName, int thresholdValue) Asserts the value is greater than some threshold.final void
isGreaterThanOrEqualTo
(int thresholdValue) Asserts the value is greater than or equal to some threshold.final void
isGreaterThanOrEqualTo
(String thresholdName, int thresholdValue) Asserts the value is greater than or equal to some threshold.final void
isLessThan
(int thresholdValue) Asserts the value is less than some threshold.final void
isLessThan
(String thresholdName, int thresholdValue) Asserts the value is less than some threshold.final void
isLessThanOrEqualTo
(int thresholdValue) Asserts the value is less than or equal to some threshold.final void
isLessThanOrEqualTo
(String thresholdName, int thresholdValue) Asserts the value is less than or equal to some threshold.final void
isNotEqualTo
(int parameterValue) Asserts the value is not equal to some other parameter.final void
isNotEqualTo
(String parameterName, int parameterValue) Asserts the value is not equal to some other parameter.Methods inherited from class org.moeaframework.util.validate.NumberValidator
failsOnCondition, failsOnCondition, isBetween, isEqualTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, isNotEqualTo
Methods inherited from class org.moeaframework.util.validate.Validator
fails, failUnsupportedOption, failUnsupportedOption, getPropertyName, getPropertyValue
-
Constructor Details
-
IntegerValidator
Constructs a new validator forint
primitives.- Parameters:
propertyName
- the property namepropertyValue
- the property value
-
-
Method Details
-
isGreaterThan
public final void isGreaterThan(int thresholdValue) Asserts the value is greater than some threshold.- Parameters:
thresholdValue
- the threshold value
-
isGreaterThan
Asserts the value is greater than some threshold.- Parameters:
thresholdName
- the threshold namethresholdValue
- the threshold value
-
isGreaterThanOrEqualTo
public final void isGreaterThanOrEqualTo(int thresholdValue) Asserts the value is greater than or equal to some threshold.- Parameters:
thresholdValue
- the threshold value
-
isGreaterThanOrEqualTo
Asserts the value is greater than or equal to some threshold.- Parameters:
thresholdName
- the threshold namethresholdValue
- the threshold value
-
isLessThan
public final void isLessThan(int thresholdValue) Asserts the value is less than some threshold.- Parameters:
thresholdValue
- the threshold value
-
isLessThan
Asserts the value is less than some threshold.- Parameters:
thresholdName
- the threshold namethresholdValue
- the threshold value
-
isLessThanOrEqualTo
public final void isLessThanOrEqualTo(int thresholdValue) Asserts the value is less than or equal to some threshold.- Parameters:
thresholdValue
- the threshold value
-
isLessThanOrEqualTo
Asserts the value is less than or equal to some threshold.- Parameters:
thresholdName
- the threshold namethresholdValue
- the threshold value
-
isEqualTo
public final void isEqualTo(int parameterValue) Asserts the value equals some other parameter.- Parameters:
parameterValue
- the parameter value
-
isEqualTo
Asserts the value equals some other parameter.- Parameters:
parameterName
- the parameter nameparameterValue
- the parameter value
-
isNotEqualTo
public final void isNotEqualTo(int parameterValue) Asserts the value is not equal to some other parameter.- Parameters:
parameterValue
- the parameter value
-
isNotEqualTo
Asserts the value is not equal to some other parameter.- Parameters:
parameterName
- the parameter nameparameterValue
- the parameter value
-
isDivisibleBy
public final void isDivisibleBy(int divisorValue) Asserts the value is divisible by some divisor.- Parameters:
divisorValue
- the divisor value
-
isDivisibleBy
Asserts the value is divisible by some divisor.- Parameters:
divisorName
- the divisor name, ornull
if no name is associated with the valuedivisorValue
- the divisor value
-
isBetween
public final void isBetween(int lower, int upper) Asserts the value is between the given lower and upper bounds, inclusive.- Parameters:
lower
- the lower boundupper
- the upper bound
-