且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

@size(max = value) 和 @min(value) 和 @max(value) 的区别

更新时间:2021-12-29 08:21:50

@Min@Max 用于验证可以是 String(代表数字)、intshortbyte 等以及它们各自的原始包装器.

@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 支持 StringCollectionMaparrays> 而 @Min@Max 支持原语及其包装器.请参阅文档.

As per documentation @Size supports String, Collection, Map and arrays while @Min and @Max supports primitives and their wrappers. See the documentation.