org.hibernate.validator.internal.cdi

## Class ValidationExtension

- java.lang.Object
- - org.hibernate.validator.internal.cdi.ValidationExtension

- All Implemented Interfaces:
    Extension

      public class ValidationExtension
      extends Object
      implements Extension

  A CDI portable extension which integrates Bean Validation with CDI. It registers the following objects:
  - Beans for `ValidatorFactory` and `Validator` representing default validator factory and validator as configured via `META-INF/validation.xml`. These beans will have the `Default` qualifier and in addition the `HibernateValidator` qualifier 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 `HibernateValidator` qualifier.
  Neither of these beans will be registered in case there is already another bean with the same type and qualifier(s), e.g. registered by another portable extension or the application itself.
  Author:
    Gunnar Morling, Hardy Ferentschik

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ValidationExtension()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterBeanDiscovery(AfterBeanDiscovery afterBeanDiscoveryEvent, BeanManager beanManager)` Registers beans for `ValidatorFactory` and `Validator` if not yet present.
    `void` | `beforeBeanDiscovery(BeforeBeanDiscovery beforeBeanDiscoveryEvent, BeanManager beanManager)` Used to register the method validation interceptor binding annotation.
    `<T> void` | `processAnnotatedType(ProcessAnnotatedType<T> processAnnotatedTypeEvent)` Used to register the method validation interceptor bindings.
    `void` | `processBean(ProcessBean<?> processBeanEvent)` Watches the `ProcessBean` event in order to determine whether beans for `ValidatorFactory` and `Validator` already have been registered by some other component.
    `Method` | `replaceWithOverriddenOrInterfaceMethod(Method method, List<Method> allMethodsOfType)`

    - ### 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

    - #### 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 starts
        `beanManager` - the bean manager.

    - #### afterBeanDiscovery

          public void afterBeanDiscovery(@Observes
                                AfterBeanDiscovery afterBeanDiscoveryEvent,
                                BeanManager beanManager)

      Registers beans for `ValidatorFactory` and `Validator` if not yet present.
      Parameters:
        `afterBeanDiscoveryEvent` - event fired after the bean discovery phase.
        `beanManager` - the bean manager.

    - #### processBean

          public void processBean(@Observes
                         ProcessBean<?> processBeanEvent)

      Watches the `ProcessBean` event in order to determine whether beans for `ValidatorFactory` and `Validator` already have been registered by some other component.
      Parameters:
        `processBeanEvent` - event fired for each enabled bean.

    - #### processAnnotatedType

          public <T> void processAnnotatedType(@Observes
                                      ProcessAnnotatedType<T> processAnnotatedTypeEvent)

      Used to register the method validation interceptor bindings.
      Parameters:
        `processAnnotatedTypeEvent` - event fired for each annotated type

    - #### replaceWithOverriddenOrInterfaceMethod

          public Method replaceWithOverriddenOrInterfaceMethod(Method method,
                                                      List<Method> allMethodsOfType)

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved