二、Jakarta Bean Validation constraints(Hibernate Validator 6.1.5.Final)

@TimeType: java.util.Date,java.util.Calendar, java.time.Instant, java.time.LocalDate, java.time.LocalDateTime, java.time.LocalTime, java.time.MonthDay, java.time.OffsetDateTime, java.time.OffsetTime, java.time.Year, java.time.YearMonth, java.time.ZonedDateTime, java.time.chrono.HijrahDate, java.time.chrono.JapaneseDate, java.time.chrono.MinguoDate, java.time.chrono.ThaiBuddhistDate; Additionally supported by HV, if the Joda Time date/time API is on the classpath: any implementations of ReadablePartial and ReadableInstant

 

@BigDataType:  BigDecimal, BigInteger, CharSequence, byte, short, int, long and the respective wrappers of the primitive types; additionally supported by HV: any sub-type of Number and javax.money.MonetaryAmount

校验类型

支持数据类型

描述

@AssertFalse

Boolean, boolean

Checks that the annotated element is false

@AssertTrue

Boolean, boolean

Checks that the annotated element is true

@DecimalMax(value=, inclusive=)

@BigDataType

Checks whether the annotated value is less than the specified maximum, when inclusive=false. Otherwise whether the value is less than or equal to the specified maximum. The parameter value is the string representation of the max value according to the BigDecimal string representation.

@DecimalMin(value=, inclusive=)

@BigDataType

Checks whether the annotated value is larger than the specified minimum, when inclusive=false. Otherwise whether the value is larger than or equal to the specified minimum. The parameter value is the string representation of the min value according to the BigDecimal string representation.

@Digits(integer=, fraction=)

@BigDataType

Checks whether the annotated value is a number having up to integer digits and fraction fractional digits

@Email

CharSequence

Checks whether the specified character sequence is a valid email address. The optional parameters regexp and flags allow to specify an additional regular expression (including regular expression flags) which the email must match.

@Future

@TimeType

Checks whether the annotated date is in the future

@FutureOrPresent

@TimeType

Checks whether the annotated date is in the present or in the future

@Max(value=)

@BigDataType

Checks whether the annotated value is less than or equal to the specified maximum

@Min(value=)

@BigDataType

Checks whether the annota

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值