public class StringLengthValidator extends CustomValidator<String>
Modifier and Type | Method and Description |
---|---|
static StringLengthValidator |
atLeast(int min,
String errorMessage)
Creates an StringLengthValidator with a given lower bound.
|
static StringLengthValidator |
between(int min,
int max,
String errorMessage)
Creates an StringLengthValidator with given lower and upper bounds.
|
static StringLengthValidator |
exactly(int value,
String errorMessage)
Creates a StringLengthValidator with a given lower and upper bound, which
are equal.
|
static StringLengthValidator |
upTo(int max,
String errorMessage)
Creates an StringLengthValidator with a given upper bound.
|
forPredicate, validate
public static StringLengthValidator 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 minimum is a negative number.public static StringLengthValidator atLeast(int min, String errorMessage)
min
- The lower bound for the validation.errorMessage
- The error message that is returned if the validation fails.IllegalArgumentException
- Thrown if the minimum is a negative number.public static StringLengthValidator 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 StringLengthValidator 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.