美文网首页
Bean Validation(数据校验注解大全 @Valid

Bean Validation(数据校验注解大全 @Valid

作者: 万事俱备就差一个程序员了 | 来源:发表于2022-07-20 17:13 被阅读0次

原文地址: https://www.cnblogs.com/nxzblogs/articles/13995569.html

@AssertFalse | bool | 元素必须是false | 否

@AssertTrue | bool | 元素必须是true | 否

@DecimalMax | Number的子类型(浮点数除外)以及String | 元素必须是一个数字,且值必须<=最大值 | 否

@DecimalMin | 同上 | 元素必须是一个数字,且值必须>=最大值 | 否

@Max | 同上 | 同上 | 否

@Min | 同上 | 同上 | 否

@Digits | 同上 | 元素构成是否合法(整数部分和小数部分) | 否

@Future | 时间类型(包括JSR310) | 元素必须为一个将来(不包含相等)的日期(比较精确到毫秒) | 否

@Past | 同上 | 元素必须为一个过去(不包含相等)的日期(比较精确到毫秒) | 否

@NotNull | any | 元素不能为null | 是

@Null | any | 元素必须为null | 是

@Pattern | 字符串 | 元素需符合指定的正则表达式 | 否

@Size | String/Collection/Map/Array | 元素大小需在指定范围中 | 否

@Email | 字符串 | 元素必须为电子邮箱地址 | 否

@NotEmpty | 容器类型 | 集合的Size必须大于0 | 是

@NotBlank | 字符串 | 字符串必须包含至少一个非空白的字符 | 是

@Positive | 数字类型 | 元素必须为正数(不包括0) | 否

@PositiveOrZero | 同上 | 同上(包括0) | 否

@Negative | 同上 | 元素必须为负数(不包括0) | 否

@NegativeOrZero | 同上 | 同上(包括0) | 否

@PastOrPresent | 时间类型 | 在@Past基础上包括相等 | 否

@FutureOrPresent | 时间类型 | 在@Futrue基础上包括相等 | 否

相关文章

网友评论

      本文标题:Bean Validation(数据校验注解大全 @Valid

      本文链接:https://www.haomeiwen.com/subject/ecqyirtx.html