public class IntegerRangeValidator extends CustomValidator<Integer>
Modifier and Type | Method and Description |
---|---|
static IntegerRangeValidator |
atLeast(int min,
String errorMessage)
Creates an IntegerRangeValidator with a given lower bound.
|
static IntegerRangeValidator |
between(int min,
int max,
String errorMessage)
Creates an IntegerRangeValidator with given lower and upper bounds.
|
static IntegerRangeValidator |
exactly(int value,
String errorMessage)
Creates a IntegerRangeValidator with a given lower and upper bound,
which are equal.
|
static IntegerRangeValidator |
upTo(int max,
String errorMessage)
Creates an IntegerRangeValidator with a given upper bound.
|
forPredicate, validate
public static IntegerRangeValidator between(int min, int max, String errorMessage)
min
- The lower bound for the validation.max
- The upper bound for the validation.errorMessage
- The error message that is returned if the validation fails.IllegalArgumentException
- Thrown if the maximum is not larger than or equal to the
minimum.public static IntegerRangeValidator atLeast(int min, String errorMessage)
min
- The lower bound for the validation.errorMessage
- The error message that is returned if the validation fails.public static IntegerRangeValidator upTo(int max, String errorMessage)
max
- The upper bound for the validation.errorMessage
- The error message that is returned if the validation fails.public static IntegerRangeValidator exactly(int value, String errorMessage)
value
- The lower and upper bound for the validation.errorMessage
- The error message that is returned if the validation fails.Copyright © 2017. All rights reserved.