java-基础-jsr-303-valid参数校验

it2022-05-05  118

1.使用场景

 

2.引用的jar包       

     javax.validation.constraints

    讨论的内容主要是这个包目录下的注解使用⚠️

参数校验注解解释 Name解释范围NotBlank(mesage=)注解的字符串不能为 “” / 空只能为String类型NotNull(mesage=)注解的参数不能为null类型没有限制Pattern(regex= , mesage=)注解的参数进行正则匹配只能为String类型NotEmpty注解的参数不能是 null CharSequence, Collection, Map 和 Array 对象Null  Size  Email  Max  Min  DecimalMax  DecimalMin  Digits  AssertFalse  AssertTrue  Future  FutureOrPresent  Past  PastOrPresent  Negative  NegativeOrZero  Positive  PositiveOrZero  

 


最新回复(0)