This section describes the Bean Validation functionality and Bean Validation operations.
The following table describes the Bean Validation functionality.
Table 10-2 Bean Validation functionality
No. | Function | Overview | |
---|---|---|---|
1 | Validating the input values | This functionality validates the validation definition specifying the value set up in JavaBean. | |
Group management functionality | This functionality groups the validation. | ||
Message management functionality | This functionality manages the messages returned when the validation result is an error. | ||
Payload management functionality | This functionality categorizes the validation results.# | ||
2 | Functionality for creating a custom validator | This functionality creates specific validation processing. | |
3 | Bootstrap functionality | This functionality enables you to change the Bean Validation provider. |
You can use the Bean Validation function by specifying annotations. The following table describes the annotation classes provided by the Bean Validation function, the variable types that can be specified, and the operations when annotations are specified in the variable types that cannot be specified.
Table 10-3 Annotation classes provided by the Bean Validation function and the types of variables
No. | Annotation class | Specifiable variable types | Operations when annotations are specified in the non-specifiable variable types | Remarks |
---|---|---|---|---|
1 | Null | Can be specified in all types | -- | -- |
2 | NotNull | Can be specified in all types | -- | -- |
3 | AssertTrue |
| javax.validation.UnexpectedTypeException is thrown. | -- |
4 | AssertFalse |
| javax.validation.UnexpectedTypeException is thrown. | -- |
5 | Min |
| javax.validation.UnexpectedTypeException is thrown. | -- |
6 | Max |
| javax.validation.UnexpectedTypeException is thrown. | -- |
7 | DecimalMin |
| javax.validation.UnexpectedTypeException is thrown. | If a value that cannot be parsed with java.math.BigDecimal is specified for the value attribute, javax.validation.ValidationException is thrown. |
8 | DecimalMax |
| javax.validation.UnexpectedTypeException is thrown. | If a value that cannot be parsed with java.math.BigDecimal is specified for the value attribute, javax.validation.ValidationException is thrown. |
9 | Size |
| javax.validation.UnexpectedTypeException is thrown. | If a negative value is specified for the max and min attributes, javax.validation.ValidationException is thrown. If a value greater than max is specified in the value for min, javax.validation.ValidationException is thrown. |
10 | Digits |
| javax.validation.UnexpectedTypeException is thrown. | If a negative value is specified for the integer and fraction attributes, javax.validation.ValidationException is thrown. |
11 | Past |
| javax.validation.UnexpectedTypeException is thrown. | -- |
12 | Future |
| javax.validation.UnexpectedTypeException is thrown. | -- |
13 | Pattern |
| javax.validation.UnexpectedTypeException is thrown. | If the value specified for the regexp attribute is an incorrect regular expression, the javax.validation.ValidationException exception is thrown. The validity of the regular expression depends on the java.util.regex.Pattern specifications. |