Friday, March 17, 2017

Spring Rest API Validation

https://jcp.org/en/jsr/detail?id=303

 @NotBlank(message = "username can't empty!")
    String username;


 @NotBlank
    @Size(min = 3, max = 50)
    private String username;

@NotEmpty
    @Length(max = 140)
    private String text;


ConstraintCompositionBoolean operator that is applied to all constraints of a composing constraint annotation.
CreditCardNumberThe annotated element has to represent a valid credit card number.
CreditCardNumber.ListDefines several @CreditCardNumber annotations on the same element.
EmailThe string has to be a well-formed email address.
Email.ListDefines several @Email annotations on the same element.
LengthValidate that the string is between min and max included.
Length.ListDefines several @Length annotations on the same element.
NotBlankValidate that the annotated string is not null or empty.
NotBlank.ListDefines several @NotBlank annotations on the same element.
NotEmptyAsserts that the annotated string, collection, map or array is not null or empty.
NotEmpty.ListDefines several @NotEmpty annotations on the same element.
RangeThe annotated element has to be in the appropriate range.
Range.ListDefines several @Range annotations on the same element.
SafeHtmlValidate a rich text value provided by the user to ensure that it contains no malicious code, such as embedded

No comments:

Post a Comment

உப்பு மாங்காய்

சுருக்குப்பை கிழவி. சுருக்கங்கள் சூழ் கிழவி. பார்க்கும் போதெல்லாம் கூடையுடனே குடியிருப்பாள். கூடை நிறைய குட்டி குட்டி மாங்காய்கள். வெட்டிக்க...