UI form could display errors when constraints are not respected. Ex : UI Text field email doesn't contains a well formatted email like this :

ORM like Hibernate can use thoses constraints validation when Pojo model must be saved in the Database.

So JSR-303 gives a commons means to declare your constraint validation that you can used in several context of your application (in your UI form, in your DAO when Pojo must be saved, etc....)

Validator API for JSR-303

JSR-303 Bean Validation provides an API to validate property, value by using JSR-303 constraints validation declared with annotations. Here a sample code to validate the value "XXX" by using the annotations declared in the "email" property of the Person class :

NOTE: this code works only if there is in the ClassPath an implementation of JSR-303 Bean Validation. If you have not an implementation, you will have this error :

Exception in thread "main" javax.validation.ValidationException: Unable to find a default provider
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)

Otherwise, with Apache implementation, teh console will display:

must match the following regular expression: .+@.+\.[a-z]+

Validator Implementation for JSR-303

JSR-303 Bean Validation provides an API but not an implementation. To execute validation with JSR-303 you need JSR-303 implementation.
It exists several implementation like:

JSR-303 JFace Databinding Validator Overview

JFace Databinding Validator support for JSR-303 provides the org.eclipse.core.databinding.validation.jsr303.Jsr303BeanValidator an implementation of org.eclipse.core.databinding.validation.IValidator which uses Validator API for JSR-303.

Create Jsr303BeanValidator

If you wish create a JFace Databinding Validator to validate "email" property of the Person class :

You can know the Class type and the property name by using the IObservableValue. That's why you can simplify your code if you are using PojoObservables or BeansObservables by creating
an instanceof of UpdateValueStrategy configured with JSR-303 by using information of IObservableValue with Jsr303BeansUpdateValueStrategyFactory like this :

with UI SWT Text and manage validation with JSR-303 support for JFace Databinding Validator.

Workspace

Here a screen of required projects to launch the Jsr303PersonSnippet :

The org.eclipse.core.databinding.validation.jsr303.samples project provides several launch in the /launch folder :

Jsr303PersonSnippet_ApacheBvalValidator.launch: launch Jsr303PersonSnippet by using Apache Bean Validator. This launch add the org.apache.bval.org.apache.bval.bundle project in the classpath to use the Apache Bean Validator.

Jsr303PersonSnippet_HibernateValidator.launch: launch Jsr303PersonSnippet by using Hibernate Validator. This launch add the org.hibernate.validator (and sfl4j) project in the classpath to use the Hibernate Validator.

Jsr303PersonSnippet_WithoutImplementationOfValidator.launch: launch Jsr303PersonSnippet without JSR-303 Bean Validation implementation to see the problem (validation can be occurred).

Run Jsr303PersonSnippet

Here a screen with Apache Bean Validator implementation (Jsr303PersonSnippet_ApacheBvalValidator.launch launch) which display error when "email" field is not valid :

Here a screen when there is no JSR-303 implementation (Jsr303PersonSnippet_WithoutImplementationOfValidator.launch launch) which display "Unable to find a default provider" because there none implementation :