JSR 303 spring3 annotation verification memo

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.