Validator
and for rejecting empty fields.
Checks for an empty field in Validator implementations can become
one-liners when using rejectIfEmpty or rejectIfEmptyOrWhitespace.
Validator, Errors
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static void | |
| public static void | invokeValidator(Validator
the validator, Object Validator to be invokedthe object to bind the parameters to target, Errors the errors, Object... Errors instance that should store the errorsone or more hint objects to be passed to the validation engine validationHints)Invoke the given |
| public static void | rejectIfEmpty(Errors
the errors, String Errors instance to register errors onthe field name to check field, String the error code, interpretable as message key errorCode)Reject the given field with the given error code if the value is empty. |
| public static void | rejectIfEmpty(Errors
the errors, String Errors instance to register errors onthe field name to check field, String error code, interpretable as message key errorCode, String fallback default message defaultMessage)Reject the given field with the given error code and default message if the value is empty. |
| public static void | rejectIfEmpty(Errors
the errors, String Errors instance to register errors onthe field name to check field, String the error code, interpretable as message key errorCode, Object[] the error arguments, for argument binding via MessageFormat
(can be errorArgs)null)Reject the given field with the given error code and error arguments if the value is empty. |
| public static void | rejectIfEmpty(Errors
the errors, String Errors instance to register errors onthe field name to check field, String the error code, interpretable as message key errorCode, Object[] the error arguments, for argument binding via MessageFormat
(can be errorArgs, String null)fallback default message defaultMessage)Reject the given field with the given error code, error arguments and default message if the value is empty. |
| public static void | rejectIfEmptyOrWhitespace(Errors
the errors, String Errors instance to register errors onthe field name to check field, String the error code, interpretable as message key errorCode)Reject the given field with the given error code if the value is empty or just contains whitespace. |
| public static void | rejectIfEmptyOrWhitespace(Errors
the errors, String Errors instance to register errors onthe field name to check field, String the error code, interpretable as message key errorCode, String fallback default message defaultMessage)Reject the given field with the given error code and default message if the value is empty or just contains whitespace. |
| public static void | rejectIfEmptyOrWhitespace(Errors
the errors, String Errors instance to register errors onthe field name to check field, String the error code, interpretable as message key errorCode, Object[] the error arguments, for argument binding via MessageFormat
(can be errorArgs)null)Reject the given field with the given error code and error arguments if the value is empty or just contains whitespace. |
| public static void | rejectIfEmptyOrWhitespace(Errors
the errors, String Errors instance to register errors onthe field name to check field, String the error code, interpretable as message key errorCode, Object[] the error arguments, for argument binding via MessageFormat
(can be errorArgs, String null)fallback default message defaultMessage)Reject the given field with the given error code, error arguments and default message if the value is empty or just contains whitespace. |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| ValidationUtils | back to summary |
|---|---|
| public ValidationUtils() | |
| invokeValidator | back to summary |
|---|---|
| public static void invokeValidator(Validator validator, Object target, Errors errors) Invoke the given
| |
| invokeValidator | back to summary |
|---|---|
| public static void invokeValidator(Validator validator, Object target, Errors errors, Object... validationHints) Invoke the given
| |
| rejectIfEmpty | back to summary |
|---|---|
| public static void rejectIfEmpty(Errors errors, String field, String errorCode) Reject the given field with the given error code if the value is empty. An 'empty' value in this context means either The object whose field is being validated does not need to be passed
in because the | |
| rejectIfEmpty | back to summary |
|---|---|
| public static void rejectIfEmpty(Errors errors, String field, String errorCode, String defaultMessage) Reject the given field with the given error code and default message if the value is empty. An 'empty' value in this context means either The object whose field is being validated does not need to be passed
in because the | |
| rejectIfEmpty | back to summary |
|---|---|
| public static void rejectIfEmpty(Errors errors, String field, String errorCode, Object[] errorArgs) Reject the given field with the given error code and error arguments if the value is empty. An 'empty' value in this context means either The object whose field is being validated does not need to be passed
in because the | |
| rejectIfEmpty | back to summary |
|---|---|
| public static void rejectIfEmpty(Errors errors, String field, String errorCode, Object[] errorArgs, String defaultMessage) Reject the given field with the given error code, error arguments and default message if the value is empty. An 'empty' value in this context means either The object whose field is being validated does not need to be passed
in because the
| |
| rejectIfEmptyOrWhitespace | back to summary |
|---|---|
| public static void rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode) Reject the given field with the given error code if the value is empty or just contains whitespace. An 'empty' value in this context means either The object whose field is being validated does not need to be passed
in because the | |
| rejectIfEmptyOrWhitespace | back to summary |
|---|---|
| public static void rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode, String defaultMessage) Reject the given field with the given error code and default message if the value is empty or just contains whitespace. An 'empty' value in this context means either The object whose field is being validated does not need to be passed
in because the | |
| rejectIfEmptyOrWhitespace | back to summary |
|---|---|
| public static void rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode, Object[] errorArgs) Reject the given field with the given error code and error arguments if the value is empty or just contains whitespace. An 'empty' value in this context means either The object whose field is being validated does not need to be passed
in because the | |
| rejectIfEmptyOrWhitespace | back to summary |
|---|---|
| public static void rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode, Object[] errorArgs, String defaultMessage) Reject the given field with the given error code, error arguments and default message if the value is empty or just contains whitespace. An 'empty' value in this context means either The object whose field is being validated does not need to be passed
in because the
| |