Overview
Bean Validator is a Java 5 metadata annotation-based framework for applying validation constraints to JavaBean-compliant classes. It also provides integration layers for using the core validation framework with Enterprise JavaBeans (EJB) 3.0, JavaServer Faces (JSF) and JBoss Seam.
It's about putting domain object-level validation where it belongs. You write the validation constraints once only while writing the bean, and can then re-use it in any number of workflows. It's not restricted to EJB 3.0 entities, either - you can use it on any class with JavaBeans-style accessors.
Features
Bean Validator features many built-in validators suitable for general use. It's also easy to extend it to support additional validators.
The principle features are:
- You use anntations to recursively define all the constraints on beans.
- Scalar validators - e.g. required, min/max length, numeric ranges.
- Comparative validators - e.g. less/greater than, before and after.
- Vetoers - e.g. only validate a property if another property is null.
- Faces integration -- link validation messages to Faces component IDs.
- EJB 3.0 integration -- validation is performed for you by an interceptor.
Please consult the User's guide for more details.