It is specifically not tied to either web or persistence tier, and is available for both server-side application programming, as well as rich client Swing application developers.
Hibernate Validator is the reference implementation of this JSR 380.
You can learn more about the integration of Bean Validation and CDI in Section 11.3, “CDI”. Section 2.3, “Built-in constraints” provides an overview of all built-in constraints coming with Hibernate Validator.
Hibernate Validator supports running with a security manager being enabled. When using field-level constraints field access strategy is used to access the value to be validated.
For instance you can add the following dependency to use the JSR 341 reference implementation: EE, JSR 346).
If your application runs in an environment which does not provide this integration out of the box, you may use the Hibernate Validator CDI portable extension by adding the following Maven dependency to your POM: Note that adding this dependency is usually not required for applications running on a Java EE application server. Assert.assert Equals; public class Car Test In this chapter you will learn how to declare (see Section 2.1, “Declaring bean constraints”) and validate (see Section 2.2, “Validating bean constraints”) bean constraints.
All the validation methods have a var-args parameter which can be used to specify which validation groups shall be considered when performing the validation.
The API is not tied to a specific application tier nor programming model.a lot of useful information about the cause of the validation failure can be determined. The values under "Example" column refer to Example 2.14, “Using Hibernate Validator comprises a basic set of commonly used constraints.These are foremost the constraints defined by the Bean Validation specification (see Section 2.3.1, “Bean Validation constraints”).The former allows to add tags without any attributes, whereas the latter allows to specify tags and optionally allowed attributes as well as accepted protocols for the attributes using the annotation Checks whether the given script can successfully be evaluated against the annotated element.In order to use this constraint, an implementation of the Java Scripting API as defined by JSR 223 ("Scripting for the Java Platform") must be a part of the class path.