Download JSR 303-bean validation specification http://jcp.org/en/jsr/detail? Id = 303
Hibernate validator is a reference implementation of bean validation. hibernate validator provides all built-in constraint implementations in the JSR 303 specification, in addition to some additional constraint. For more information about hibernate validator, see the http://www.hibernate.org/subprojects/validator.html.
Spring official description: http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/validation.html#validation-beanvalidation
Table 1. constraint built in bean Validation
ConstraintDetails
@Null |
The annotated element must benull |
@NotNull |
The element to be commented must not benull |
@AssertTrue |
The annotated element must betrue |
@AssertFalse |
The annotated element must befalse |
@Min(value) |
The annotated element must be a number and its value must be greater than or equal to the specified minimum value. |
@Max(value) |
The annotated element must be a number and its value must be less than or equal to the specified maximum value. |
@DecimalMin(value) |
The annotated element must be a number and its value must be greater than or equal to the specified minimum value. |
@DecimalMax(value) |
The annotated element must be a number and its value must be less than or equal to the specified maximum value. |
@Size(max, min) |
The size of the element to be commented must be within the specified range. |
@Digits (integer, fraction) |
The annotated element must be a number and its value must be within the acceptable range. |
@Past |
The annotated element must be a previous date. |
@Future |
The annotated element must be a future date. |
@Pattern(value) |
The annotated element must conform to the specified regular expression. |
Table 2. The constraint attached to hibernate validator
ConstraintDetails
@Email |
The annotated element must be an email address. |
@Length |
The size of the commented string must be within the specified range. |
@NotEmpty |
The commented string must be non-empty. |
@Range |
The annotated element must be within the appropriate range. |