From the course: Java EE: Bean Validation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Pattern, Boolean, and date constraints introduction

Pattern, Boolean, and date constraints introduction

From the course: Java EE: Bean Validation

Start my 1-month free trial

Pattern, Boolean, and date constraints introduction

- [Instructor] Now I want to move on to the final group of constraints. This group is kind of a miscellaneous group that includes constraints for dates, boolean values, email format, and most interestingly, regular expression patterns. Let's start with the simplest group, the boolean value constraints. They are pretty self-explanatory and are AssertTrue and AssertFalse. They ensure that either a value is true or false. The next group of constraints validate date values. They are Future, FutureOrPresent, Past, and PastOrPresent. Again, these are fairly self-explanatory and constrain the field or property they annotate to being either in the future or past or a combination of the present with either future or past. A use for this will be to constrain on date of birth, which logically must be in the past, or delivery date, which must logically be in the future or in the present. Now the next constraint is clearly very useful, as it ensures that an email conforms to the standard format of…

Contents