JSR-303 Check Type Daquan

Source: Internet
Author: User

Air Check

@Null Verify that the object is Null

@NotNull Verify that the object is not null and cannot search for a string of length 0

@NotBlank Check that the constraint string is null and that the length of the trim is greater than 0, only for strings, and that the front and back spaces are removed.

@NotEmpty check whether the constraint element is null or empty.

Booelan Inspection

@AssertTrue Verify that the Boolean object is True

@AssertFalse Verify that the Boolean object is False

Length Check

@Size (min=, max=) verifies whether the object (array,collection,map,string) length is within a given range

@Length (min=, max=) validates that annotated string is between Min and Max included.

Date Check

@Past Verify that Date and Calendar objects are before the current time

@Future Verify that Date and Calendar objects are after the current time

@Pattern to verify that a String object conforms to the rules of a regular expression

Numeric check, recommended for use in Stirng,integer type, not recommended on int type, because the form value is "" cannot be converted to int, but can be converted to stirng as "", Integer is null

@Min Verify that the number and String objects are large equal to the specified value

@Max Verify that number and String objects are small equal to the specified value

@DecimalMax the value to be annotated must be not greater than the maximum specified in the constraint. The parameter of this constraint is a string representation of the maximum value defined by BigDecimal. Decimal existence Precision

@DecimalMin the value being annotated must be no less than the minimum value specified in the constraint. The parameter of this constraint is a string representation of the minimum value defined by BigDecimal. Decimal existence Precision

@Digits Verify that the composition of number and String is legal

@Digits (integer=,fraction=) verifies that the string is a number that matches the specified format, interger Specifies the integer precision, fraction specifies the decimal precision.

@Range (min=, max=) checks whether the number is between Min and Max.

@Range (min=10000,max=50000,message= "Range.bean.wage")
Private BigDecimal wage;

@Valid recursive validation of the associated object, if the associated object is a collection or an array, the elements of which are recursively validated and, if it is a map, the value part is validated. (recursive validation is performed)

@CreditCardNumber Credit Card Verification

@Email Verify that it is a mail address and, if NULL, does not validate, counting through validation.

@ScriptAssert (lang=, script=, alias=)

@URL (protocol=,host=, port=,regexp=, flags=)

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.