org.hibernate.validator.internal.cdi
Class ValidationExtension

java.lang.Object
  extended by org.hibernate.validator.internal.cdi.ValidationExtension
All Implemented Interfaces:
javax.enterprise.inject.spi.Extension

public class ValidationExtension
extends Object
implements javax.enterprise.inject.spi.Extension

A CDI portable extension which registers beans for ValidatorFactory and Validator, if such beans not yet exist (which for instance would be the case in a Java EE 6 container). All registered beans will be ApplicationScoped.

Author:
Gunnar Morling, Hardy Ferentschik

Constructor Summary
ValidationExtension()
           
 
Method Summary
 void afterBeanDiscovery(javax.enterprise.inject.spi.AfterBeanDiscovery afterBeanDiscoveryEvent, javax.enterprise.inject.spi.BeanManager beanManager)
          Registers the Hibernate specific ValidatorFactory and Validator.
 void beforeBeanDiscovery(javax.enterprise.inject.spi.BeforeBeanDiscovery beforeBeanDiscoveryEvent, javax.enterprise.inject.spi.BeanManager beanManager)
          Used to register the method validation interceptor binding annotation.
<T> void
processAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType<T> processAnnotatedTypeEvent)
          Used to register the method validation interceptor bindings.
 void processBean(javax.enterprise.inject.spi.ProcessBean processBeanEvent)
          Watches the ProcessBean event in order to determine whether and under which qualifiers ValidatorFactorys and Validators get registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationExtension

public ValidationExtension()
Method Detail

afterBeanDiscovery

public void afterBeanDiscovery(@Observes
                               javax.enterprise.inject.spi.AfterBeanDiscovery afterBeanDiscoveryEvent,
                               javax.enterprise.inject.spi.BeanManager beanManager)
Registers the Hibernate specific ValidatorFactory and Validator. The qualifiers used for registration depend on which other beans have already registered these type of beans.

Parameters:
afterBeanDiscoveryEvent - event fired after the bean discovery phase.
beanManager - the bean manager.

processBean

public void processBean(@Observes
                        javax.enterprise.inject.spi.ProcessBean processBeanEvent)
Watches the ProcessBean event in order to determine whether and under which qualifiers ValidatorFactorys and Validators get registered.

Parameters:
processBeanEvent - event fired for each enabled bean.

beforeBeanDiscovery

public void beforeBeanDiscovery(@Observes
                                javax.enterprise.inject.spi.BeforeBeanDiscovery beforeBeanDiscoveryEvent,
                                javax.enterprise.inject.spi.BeanManager beanManager)
Used to register the method validation interceptor binding annotation.

Parameters:
beforeBeanDiscoveryEvent - event fired before the bean discovery process starts
beanManager - the bean manager.

processAnnotatedType

public <T> void processAnnotatedType(@Observes
                                     javax.enterprise.inject.spi.ProcessAnnotatedType<T> processAnnotatedTypeEvent)
Used to register the method validation interceptor bindings.

Parameters:
processAnnotatedTypeEvent - event fired for each annotated type


Copyright © 2007-2013 Red Hat Middleware, LLC. All Rights Reserved