[OmniFaces utilities] The
getBeanValidatorFactory()
bootstraps the Validation
using the default validation provider resolver.Method:
Usage:
Those who
are familiar with Bean Validation and implicitly with javax.validation.Validation, knows
that there are three ways to bootstrap the Validation:
·
using the Validation#buildDefaultValidatorFactory()
·
choosing a custom ValidationProviderResolver
·
specifying explicitly and in a type safe
fashion the expected provider
As you can
see from the source code listed above, OmniFaces uses the first approach. So,
whenever you need to bootstrap the javax.validation.Validation via the Validation#buildDefaultValidatorFactory(), you can
use the OmniFaces shortcut, getBeanValidatorFactory() as below:
import
org.omnifaces.util.Platform;
import javax.validation.ValidatorFactory;
...
ValidationFactory
validationFactory = Platform.getBeanValidatorFactory();
Niciun comentariu :
Trimiteți un comentariu