In this video, learn about the date constraints. Date constraints test if a date is in the past or in the future. Also, apply boolean assertions to data fields that assert that a value should be true or false. Learn how to use regular expressions to create constraints that conform to a given pattern. Constraints included are: @AssertTrue, @AssertFalse, @Future, @FutureOrPresent, @Past, @PastOrPresent, @Email, and @Pattern.
- [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 an email address.…Under the hood of the email constraint, it applies…
In this course, you can journey through the many constraints that are built into the 2.0 version of the Bean Validation API, as well as the additional constraints provided by the Hibernate Validator 6.0. Learn Bean Validation in a practical way while you build a functioning web application. Instructor Alex Theedom shows how to extend the API with custom constraints and how to internationalize validation failure messages. Plus, learn advanced techniques such as cross-field and cross-parameter validation, and how Bean Validation integrates with other Java EE technologies such as JAX-RS, Java Persistence API (JPA), and JavaServer Faces (JSF). By the end of this course, you will have gained practical experience of using Bean Validation in a real web application and be able to implement what you have learned in your own Java applications.
- What is Bean Validation?
- Applying the built-in constraints
- Applying Hibernate constraints
- Designing custom constraint validators
- Managing and configuring validation failure messages
- Creating custom composite constraints
- Creating custom validation constraints
- Cross-field and cross-parameter validation
- Integration with RESTful web services (JAX-RS)