Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 2.51 KB

common_constraints_annotations.md

File metadata and controls

26 lines (22 loc) · 2.51 KB

List of constraint annotations supported by CUBA studio

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.
@Email 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.

Other useful annotations

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.

Back to the article