java.lang.Object
io.helidon.validation.Validators
Programmatic API to validate values and types.
There are always two methods for validation - one starting with
validate and one starting with check.
The validate method will return a ValidationResponse, while the check method will throw an
ValidationException if the validation fails.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckCalendarFuture(Object value) Check that the calendar value is in the future.static voidCheck that the calendar value is in the future or present.static voidcheckCalendarPast(Object value) Check that the calendar value is in the past.static voidcheckCalendarPastOrPresent(Object value) Check that the calendar value is in the past or present.static voidcheckCollectionSize(Object value, int minSize, int maxSize) Check that the collection value has the specified size.static voidcheckDigits(Number value, int integerDigits, int fractionDigits) Check that the number value has the specified number of digits.static voidcheckEmail(CharSequence value) Check that the string value is a valid email address.static voidcheckFalse(Boolean value) Check that the boolean value is false.static voidcheckLength(CharSequence value, int minLength, int maxLength) Check that the string value has the specified length.static voidCheck that the integer value is less than or equal to the maximum value.static voidCheck that the long value is less than or equal to the maximum value.static voidCheck that the number value is less than or equal to the maximum value.static voidCheck that the integer value is greater than or equal to the minimum value.static voidCheck that the long value is greater than or equal to the minimum value.static voidCheck that the number value is greater than or equal to the minimum value.static voidcheckNegative(Number value) Check that the number value is negative.static voidcheckNegativeOrZero(Number value) Check that the number value is negative or zero.static voidcheckNotBlank(CharSequence value) Check that the string value is not blank.static voidcheckNotEmpty(CharSequence value) Check that the string value is not empty.static voidcheckNotNull(Object value) Check that the value is not null.static voidCheck that the value is null.static voidcheckPattern(CharSequence value, String pattern) Check that the string value matches the specified pattern.static voidcheckPositive(Number value) Check that the number value is positive.static voidcheckPositiveOrZero(Number value) Check that the number value is positive or zero.static voidCheck that the boolean value is true.static ValidationResponsevalidateCalendarFuture(Object value) Check that the calendar value is in the future.static ValidationResponseCheck that the calendar value is in the future or present.static ValidationResponsevalidateCalendarPast(Object value) Check that the calendar value is in the past.static ValidationResponseCheck that the calendar value is in the past or present.static ValidationResponsevalidateCollectionSize(Object value, int minSize, int maxSize) Check that the collection value has the specified size.static ValidationResponsevalidateDigits(Number value, int integerDigits, int fractionDigits) Check that the number value has the specified number of digits.static ValidationResponsevalidateEmail(CharSequence value) Check that the string value is a valid email address.static ValidationResponsevalidateFalse(Boolean value) Check that the boolean value is false.static ValidationResponsevalidateLength(CharSequence value, int minLength, int maxLength) Check that the string value has the specified length.static ValidationResponsevalidateMax(Integer value, int maxValue) Check that the integer value is less than or equal to the maximum value.static ValidationResponsevalidateMax(Long value, long maxValue) Check that the long value is less than or equal to the maximum value.static ValidationResponsevalidateMax(Number value, String maxValue) Check that the number value is less than or equal to the maximum value.static ValidationResponsevalidateMin(Integer value, int minValue) Check that the integer value is greater than or equal to the minimum value.static ValidationResponsevalidateMin(Long value, long minValue) Check that the long value is greater than or equal to the minimum value.static ValidationResponsevalidateMin(Number value, String minValue) Check that the number value is greater than or equal to the minimum value.static ValidationResponsevalidateNegative(Number value) Check that the number value is negative.static ValidationResponsevalidateNegativeOrZero(Number value) Check that the number value is negative or zero.static ValidationResponsevalidateNotBlank(CharSequence value) Check that the string value is not blank.static ValidationResponsevalidateNotEmpty(CharSequence value) Check that the string value is not empty.static ValidationResponsevalidateNotNull(Object value) Check that the value is not null.static ValidationResponsevalidateNull(Object value) Check that the value is null.static ValidationResponsevalidatePattern(CharSequence value, String pattern) Check that the string value matches the specified pattern.static ValidationResponsevalidatePositive(Number value) Check that the number value is positive.static ValidationResponsevalidatePositiveOrZero(Number value) Check that the number value is positive or zero.static ValidationResponsevalidateTrue(Boolean value) Check that the boolean value is true.
-
Method Details
-
validateNotNull
Check that the value is not null.- Parameters:
value- value to check- Returns:
- validation response
-
checkNotNull
Check that the value is not null.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateNull
Check that the value is null.- Parameters:
value- value to check- Returns:
- validation response
-
checkNull
Check that the value is null.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateEmail
Check that the string value is a valid email address.- Parameters:
value- value to check- Returns:
- validation response
-
checkEmail
Check that the string value is a valid email address.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateNotBlank
Check that the string value is not blank.- Parameters:
value- value to check- Returns:
- validation response
-
checkNotBlank
Check that the string value is not blank.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateNotEmpty
Check that the string value is not empty.- Parameters:
value- value to check- Returns:
- validation response
-
checkNotEmpty
Check that the string value is not empty.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateLength
Check that the string value has the specified length.- Parameters:
value- value to checkminLength- minimum length (inclusive)maxLength- maximum length (inclusive)- Returns:
- validation response
-
checkLength
Check that the string value has the specified length.- Parameters:
value- value to checkminLength- minimum length (inclusive)maxLength- maximum length (inclusive)- Throws:
ValidationException- if the validation fails
-
validatePattern
Check that the string value matches the specified pattern.- Parameters:
value- value to checkpattern- regular expression pattern- Returns:
- validation response
-
checkPattern
Check that the string value matches the specified pattern.- Parameters:
value- value to checkpattern- regular expression pattern- Throws:
ValidationException- if the validation fails
-
validateNegative
Check that the number value is negative.- Parameters:
value- value to check- Returns:
- validation response
-
checkNegative
Check that the number value is negative.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateNegativeOrZero
Check that the number value is negative or zero.- Parameters:
value- value to check- Returns:
- validation response
-
checkNegativeOrZero
Check that the number value is negative or zero.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validatePositive
Check that the number value is positive.- Parameters:
value- value to check- Returns:
- validation response
-
checkPositive
Check that the number value is positive.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validatePositiveOrZero
Check that the number value is positive or zero.- Parameters:
value- value to check- Returns:
- validation response
-
checkPositiveOrZero
Check that the number value is positive or zero.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateMin
Check that the number value is greater than or equal to the minimum value.- Parameters:
value- value to checkminValue- minimum value- Returns:
- validation response
-
checkMin
Check that the number value is greater than or equal to the minimum value.- Parameters:
value- value to checkminValue- minimum value- Throws:
ValidationException- if the validation fails
-
validateMax
Check that the number value is less than or equal to the maximum value.- Parameters:
value- value to checkmaxValue- maximum value- Returns:
- validation response
-
checkMax
Check that the number value is less than or equal to the maximum value.- Parameters:
value- value to checkmaxValue- maximum value- Throws:
ValidationException- if the validation fails
-
validateDigits
public static ValidationResponse validateDigits(Number value, int integerDigits, int fractionDigits) Check that the number value has the specified number of digits.- Parameters:
value- value to checkintegerDigits- maximum number of integer digitsfractionDigits- maximum number of fraction digits- Returns:
- validation response
-
checkDigits
Check that the number value has the specified number of digits.- Parameters:
value- value to checkintegerDigits- maximum number of integer digitsfractionDigits- maximum number of fraction digits- Throws:
ValidationException- if the validation fails
-
validateMin
Check that the integer value is greater than or equal to the minimum value.- Parameters:
value- value to checkminValue- minimum value- Returns:
- validation response
-
checkMin
Check that the integer value is greater than or equal to the minimum value.- Parameters:
value- value to checkminValue- minimum value- Throws:
ValidationException- if the validation fails
-
validateMax
Check that the integer value is less than or equal to the maximum value.- Parameters:
value- value to checkmaxValue- maximum value- Returns:
- validation response
-
checkMax
Check that the integer value is less than or equal to the maximum value.- Parameters:
value- value to checkmaxValue- maximum value- Throws:
ValidationException- if the validation fails
-
validateMin
Check that the long value is greater than or equal to the minimum value.- Parameters:
value- value to checkminValue- minimum value- Returns:
- validation response
-
checkMin
Check that the long value is greater than or equal to the minimum value.- Parameters:
value- value to checkminValue- minimum value- Throws:
ValidationException- if the validation fails
-
validateMax
Check that the long value is less than or equal to the maximum value.- Parameters:
value- value to checkmaxValue- maximum value- Returns:
- validation response
-
checkMax
Check that the long value is less than or equal to the maximum value.- Parameters:
value- value to checkmaxValue- maximum value- Throws:
ValidationException- if the validation fails
-
validateTrue
Check that the boolean value is true.- Parameters:
value- value to check- Returns:
- validation response
-
checkTrue
Check that the boolean value is true.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateFalse
Check that the boolean value is false.- Parameters:
value- value to check- Returns:
- validation response
-
checkFalse
Check that the boolean value is false.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateCalendarFuture
Check that the calendar value is in the future.- Parameters:
value- value to check- Returns:
- validation response
-
checkCalendarFuture
Check that the calendar value is in the future.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateCalendarFutureOrPresent
Check that the calendar value is in the future or present.- Parameters:
value- value to check- Returns:
- validation response
-
checkCalendarFutureOrPresent
Check that the calendar value is in the future or present.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateCalendarPast
Check that the calendar value is in the past.- Parameters:
value- value to check- Returns:
- validation response
-
checkCalendarPast
Check that the calendar value is in the past.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateCalendarPastOrPresent
Check that the calendar value is in the past or present.- Parameters:
value- value to check- Returns:
- validation response
-
checkCalendarPastOrPresent
Check that the calendar value is in the past or present.- Parameters:
value- value to check- Throws:
ValidationException- if the validation fails
-
validateCollectionSize
Check that the collection value has the specified size.- Parameters:
value- value to checkminSize- minimum size (inclusive)maxSize- maximum size (inclusive)- Returns:
- validation response
-
checkCollectionSize
Check that the collection value has the specified size.- Parameters:
value- value to checkminSize- minimum size (inclusive)maxSize- maximum size (inclusive)- Throws:
ValidationException- if the validation fails
-