Annotations |
Applicable data types |
Description |
@AssertFalse |
Boolean, Boolean |
Verify that the element value of the annotation is false |
@AssertTrue |
Boolean, Boolean |
Verify that the element value of the annotation is true |
@DecimalMax (value=x) |
BigDecimal, BigInteger, String, byte,short, int, long and the respective wrappers of the primitive. Additionally supported by Hv:any sub-type of number andcharsequence. |
Verifies that the element value of the annotation is less than or equal to the value specified by @ Decimalmax |
@DecimalMin (value=x) |
BigDecimal, BigInteger, String, byte,short, int, long and the respective wrappers of the primitive. Additionally supported by Hv:any sub-type of number andcharsequence. |
Verifies that the element value of the annotation is less than or equal to the value specified by @ decimalmin |
@Digits (integer= integer digits, fraction= decimal place) |
BigDecimal, BigInteger, String, byte,short, int, long and the respective wrappers of the primitive. Additionally supported by Hv:any sub-type of number andcharsequence. |
To verify the integer and maximum number of decimal digits for the element value of the annotation |
@Future |
Java.util.Date, Java.util.Calendar; Additionally supported by HV, if Thejoda time Date/time API was on the class Path:any implementations ofreadablepartial an Dreadableinstant. |
Verify that the annotation's element value (date type) is later than the current time |
@Max (value=x) |
BigDecimal, BigInteger, Byte, Short,int, long and the respective wrappers of the primitive types. Additionally supported by Hv:any sub-type ofcharsequence (the numeric value represented by the character sequence is eval uated), any sub-type of number. |
Verifies that the element value of the annotation is less than or equal to the value specified by @max |
@Min (value=x) |
BigDecimal, BigInteger, Byte, Short,int, long and the respective wrappers of the primitive types. Additionally supported by Hv:any sub-type of charsequence (the numeric value represented by the char sequence is evaluate d), any sub-type of number. |
Verifies that the element value of the annotation is greater than or equal to the value specified by @min |
@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 |
@Past |
Java.util.Date, Java.util.Calendar; Additionally supported by HV, if Thejoda time Date/time API was on the class Path:any implementations ofreadablepartial an Dreadableinstant. |
Verify that the annotation's element value (date type) is earlier than the current time |
@Pattern (regex= Regular expression, flag=) |
String. Additionally supported by Hv:any sub-type of Charsequence. |
Validates that the element value of the annotation matches the specified regular expression |
@Size (min= min, max= max) |
String, Collection, Map and arrays. Additionally supported by Hv:any sub-type of Charsequence. |
Verifies that the element value of the annotation is within a specified interval of min and max (inclusive), such as character length, collection size |
@Valid |
Any non-primitive type (reference type) |
Validates the associated object, such as an order object in the account object, specifying the validation order object |
@NotEmpty |
CharSequence ,Collection ,Map and Arrays
|
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) |
CharSequence, Collection, Map and Arrays,BigDecimal, BigInteger, CharSequence, byte, short, int, long and the respective wrappers of the primitive types
|
Verifies that the element value of the annotation is between the minimum and maximum values |
@NotBlank |
CharSequence
|
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, @NotBlank is applied only to strings and the whitespace is stripped of the string when compared |
@Length (min= lower limit, max= upper limit) |
CharSequence
|
Validates the element value length of annotations within min and Max intervals |
@Email |
CharSequence
|
Verify that the element value of the annotation is email, or you can specify a custom email format via regular expressions and flag |