'javax.validation.constraints' package provides number of annotations to do validations on data.
Below table summarizes the annotations provided by JSR-380 specification.
Annotation | Description |
AssertFalse | |
AssertFalse.List | Defines several |
AssertTrue | The Annotated Element must be true. |
AssertTrue.List | Defines several |
DecimalMax | The annotated element must be a number whose value must be lower or equal to the specified maximum. |
DecimalMax.List | Defines several |
DecimalMin | The annotated element must be a number whose value must be higher or equal to the specified minimum. |
DecimalMin.List | Defines several |
Digits | The annotated element must be a number within accepted range Supported types are: |
Digits.List | Defines several |
| The string has to be a well-formed email address. |
Email.List | Defines several |
Future | The annotated element must be an instant, date or time in the future. |
Future.List | Defines several |
FutureOrPresent | The annotated element must be an instant, date or time in the present or in the future. |
FutureOrPresent.List | Defines several |
Max | The annotated element must be a number whose value must be lower or equal to the specified maximum. |
Max.List | Defines several |
Min | The annotated element must be a number whose value must be higher or equal to the specified minimum. |
Min.List | Defines several |
Negative | The annotated element must be a strictly negative number (i.e. |
Negative.List | Defines several |
NegativeOrZero | The annotated element must be a negative number or 0. |
NegativeOrZero.List | Defines several |
NotBlank | The annotated element must not be |
NotBlank.List | Defines several |
NotEmpty | The annotated element must not be |
NotEmpty.List | Defines several |
NotNull | The annotated element must not be |
NotNull.List | Defines several |
Null | The annotated element must be |
Null.List | Defines several |
Past | The annotated element must be an instant, date or time in the past. |
Past.List | |
This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here