更新时间:2021-12-29 08:21:50
@Min
和 @Max
用于验证可以是 String(代表数字)、
int
、short
、byte
等以及它们各自的原始包装器.
@Min
and @Max
are used for validating numeric fields which could be String
(representing number), int
, short
, byte
etc and their respective primitive wrappers.
@Size
用于检查字段的长度限制.
@Size
is used to check the length constraints on the fields.
根据文档 @Size
支持 String
、Collection
、Map
和 arrays
> 而 @Min
和 @Max
支持原语及其包装器.请参阅文档.
As per documentation @Size
supports String
, Collection
, Map
and arrays
while @Min
and @Max
supports primitives and their wrappers. See the documentation.