Package org.hibernate.validator.cdi
Class ValidationExtension
java.lang.Object
org.hibernate.validator.cdi.ValidationExtension
- All Implemented Interfaces:
Extension
- Direct Known Subclasses:
ValidationExtension
A CDI portable extension which integrates Bean Validation with CDI. It registers the following objects:
-
Beans for
ValidatorFactoryandValidatorrepresenting default validator factory and validator as configured viaMETA-INF/validation.xml. These beans will have theDefaultqualifier and in addition theHibernateValidatorqualifier if Hibernate Validator is the default validation provider. - In case Hibernate Validator is not the default provider, another pair of beans will be registered in
addition which are qualified with the
HibernateValidatorqualifier.
- Author:
- Gunnar Morling, Hardy Ferentschik
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterBeanDiscovery(AfterBeanDiscovery afterBeanDiscoveryEvent, BeanManager beanManager) Registers beans forValidatorFactoryandValidatorif not yet present.voidbeforeBeanDiscovery(BeforeBeanDiscovery beforeBeanDiscoveryEvent, BeanManager beanManager) Used to register the method validation interceptor binding annotation.<T> voidprocessAnnotatedType(ProcessAnnotatedType<T> processAnnotatedTypeEvent) Used to register the method validation interceptor bindings.voidprocessBean(ProcessBean<?> processBeanEvent) Watches theProcessBeanevent in order to determine whether beans forValidatorFactoryandValidatoralready have been registered by some other component.
-
Constructor Details
-
ValidationExtension
public ValidationExtension()
-
-
Method Details
-
beforeBeanDiscovery
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeBeanDiscoveryEvent, BeanManager beanManager) Used to register the method validation interceptor binding annotation.- Parameters:
beforeBeanDiscoveryEvent- event fired before the bean discovery process startsbeanManager- the bean manager.
-
afterBeanDiscovery
public void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscoveryEvent, BeanManager beanManager) Registers beans forValidatorFactoryandValidatorif not yet present.- Parameters:
afterBeanDiscoveryEvent- event fired after the bean discovery phase.beanManager- the bean manager.
-
processBean
Watches theProcessBeanevent in order to determine whether beans forValidatorFactoryandValidatoralready have been registered by some other component.- Parameters:
processBeanEvent- event fired for each enabled bean.
-
processAnnotatedType
Used to register the method validation interceptor bindings.- Type Parameters:
T- the annotated type- Parameters:
processAnnotatedTypeEvent- event fired for each annotated type
-