更新时间:2022-01-03 09:05:31
@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.