Annotation | Types (Standard for CUBA entities) | Note |
---|---|---|
@NotNull | All | The annotated element must not be null. |
@Length | String | Validate that the string is between min and max included. |
@Pattern | String | The annotated String must match the specified regular expression. |
String | Checks that the string has to be a well-formed email address. | |
@Min | Integer, Long | A number whose value must be higher or equal to the specified minimum. |
@Max | Integer, Long | A number whose value must be lower or equal to the specified maximum. |
@Digits | BigDecimal, Double, Integer, Long | Sets the max number of integer and fractional digits of the number. |
@DecimalMin | BigDecimal, Double | Same as @Min but you can specify fractional part and set inclusive flag. |
@DecimalMax | BigDecimal, Double | Same as @Max but you can specify fractional part and set inclusive flag. |
@Past | Date, DateTime | Element must be a date in the past. |
@Future | Date, DateTime | Element must be a date in the future. |
Annotation | Types | Note |
---|---|---|
@Size | CharSequence, Collection , Map, array | The annotated element size must be between the specified boundaries (included). |
@Valid | Reference fields | Marks reference field for cascade validation. Documentation. |
@RequiredView | Service method and it's parameters | Ensures that entity instances are loaded with all the attributes specified in the view. Documentation. |
@Validated | Middleware services methods | Marks middleware methods parameters and return data for validation. See documentation for details. |