BeanValidation is a part of JavaEE that is used for validation of data. You use java annotations to describe restrictions and constraints for your java classes. The validator can then evaluate these annotations and give you an answer whether your objects are “valid” or “invalid”. At the moment there are 3 ways to use this validation.
By hand. To do this you use an instance of the Validator class and use the method “validate”. As the result you get a collection of ConstraintViolation objects for every violation. When this collections is empty your object is considered to be valid.
When using JavaServer Faces 2 (JSF) as frontend framework validation can be done automatically. You have nothing to do but to put an BeanValidation implementation (Hibernate Validator or Apache BVal) on the classpath or use an JavaEE compatible application server.
When you are using JavaPersistence API (JPA) to persist your data validation is also done automatically. Everytime an Entity with BeanValidation annotations gets persisted by the EntityManager the validation is done in the first place.
In the talk I was showing some of the build-in annotations and how you can create your own custom constraints and custom validators to fit your needs. I also showed how you could include the Apache Commons Validator into the BeanValidation framework.
The Example code is available on Github: https://github.com/lestard/juggr_BeanValidation