@AssertTrue |
Boolean,boolean |
Verify that the element value of the annotation is true |
@NotNull |
Any type |
Verify that the element value of the annotation is not null |
@Null |
Any type |
Verify that the element value of the annotation is null |
@Min (value= value) |
Bigdecimal,biginteger, Byte,short, int, long, and so on any number or charsequence (stored as a numeric) subtype |
Verifies that the element value of the annotation is greater than or equal to the value specified by @min |
@Max (value= value) |
Same as the @min requirements. |
Verifies that the element value of the annotation is less than or equal to the value specified by @max |
@DecimalMin (value= value) |
Same as the @min requirements. |
Verifies that the element value of the annotation is greater than or equal to the value specified by @ decimalmin |
@DecimalMax (value= value) |
Same as the @min requirements. |
Verifies that the element value of the annotation is less than or equal to the value specified by @ Decimalmax |
@Digits (integer= integer digits, fraction= decimal place) |
Same as the @min requirements. |
To verify the integer and maximum number of decimal digits for the element value of the annotation |
@Size (min= lower limit, max= upper limit) |
String, Collection, Map, array, etc. |
Verifies that the element value of the annotation is within a specified interval of min and max (inclusive), such as character length, collection size |
@Past |
Java.util.date,java.util.calendar; Joda date type of the time class library |
Verify that the annotation's element value (date type) is earlier than the current time |
@Future |
Same as the @past requirements |
Verify that the annotation's element value (date type) is later than the current time |
@NotBlank |
Charsequence Sub-type |
Verifies that the element value of the annotation is not null (NOT NULL, the first space is removed after the length is 0), differs from @notempty, that the @NotBlank is applied only to strings and that the first space of the string is stripped when compared |
@Length (min= lower limit, max= upper limit) |
Charsequence Sub-type |
Validates the element value length of annotations within min and Max intervals |
@NotEmpty |
Charsequence subtype, Collection, Map, array |
Verifies that the element value of the annotation is not null and is not empty (string length is not 0, collection size is not 0) |
@Range (min= min, max= max) |
Bigdecimal,biginteger,charsequence, Byte, short, int, long, etc. atomic type and packing type |
Verifies that the element value of the annotation is between the minimum and maximum values |
@Email (regexp= Regular expression, flag= flag pattern) |
Charsequence subtype (such as String) |
Verify that the element value of the annotation is email, or you can specify a custom email format via REGEXP and flag |
@Pattern (regexp= Regular expression, flag= flag pattern) |
String, the subtype of any charsequence |
Validates that the element value of the annotation matches the specified regular expression |
@Valid |
Any non-atomic type |
Specifies the object that the recursive validation is associated with, such as having an Address object property in the user object, if you want to validate the address object together when validating the user object, then add @valid annotations on the Address object to cascade validation |