public class DefaultBeanValidationManager extends Object implements BeanValidationManager
This is the central class for javax.validation (JSR-303) in a Struts2 setup : It bootstraps a javax.validation.ValidationFactory and exposes it through the javax.validation.Validator interface. When talking to an instance of this bean we will be talking to the default Validator of the underlying ValidatorFactory.
This is very convenient in that you don't have to perform yet another call on the factory, assuming that you will
almost always use the default Validator anyway. You need to pass provider class in order for this plugin to hook
itself to underlying validation Factory. Any of following Validation provider can be provided using
struts.beanValidation.providerClass
org.hibernate.validator.HibernateValidator
org.apache.bval.jsr303.ApacheValidationProvider
Modifier and Type | Field and Description |
---|---|
protected Class |
providerClass |
Constructor and Description |
---|
DefaultBeanValidationManager(String providerClassName,
String ignoreXMLConfiguration,
ObjectFactory objectFactory) |
Modifier and Type | Method and Description |
---|---|
javax.validation.Validator |
getValidator()
Method to return Validator instance.This will take in to account the provider class will try to create a
validation factory from given Validator.
|
protected Class providerClass
public DefaultBeanValidationManager(String providerClassName, String ignoreXMLConfiguration, ObjectFactory objectFactory)
public javax.validation.Validator getValidator()
Method to return Validator instance.This will take in to account the provider class will try to create a validation factory from given Validator. Validator will be returned based on the user preference.Validator will be created based on the following cases.
In case user has specify explicitly and in a type safe fashion the expected provider, it will be used to create validation factory and an instance of javax.validation.Validator will be returned.
In this case, the default validation provider resolver will be used to locate available providers. The chosen provider is defined as followed:
getValidator
in interface BeanValidationManager
Copyright © 2000–2024 Apache Software Foundation. All rights reserved.