org.jboss.resteasy.cdi

## Class ResteasyCdiExtension

- java.lang.Object
- - org.jboss.resteasy.cdi.ResteasyCdiExtension

- All Implemented Interfaces:
    javax.enterprise.inject.spi.Extension

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

  This Extension handles default scopes for discovered JAX-RS components. It also observes ProcessInjectionTarget event and wraps InjectionTargets representing JAX-RS components within JaxrsInjectionTarget. Furthermore, it builds the sessionBeanInterface map which maps Session Bean classes to a local interface. This map is used in CdiInjectorFactory during lookup of Sesion Bean JAX-RS components.
  Author:
    Jozef Hartinger

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Annotation` | `applicationScopedLiteral`
    `static Annotation` | `requestScopedLiteral`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResteasyCdiExtension()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<Class>` | `getProviders()`
    `List<Class>` | `getResources()`
    `Map<Class<?>,Type>` | `getSessionBeanInterface()`
    `static boolean` | `isCDIActive()`
    `<T extends Application> void` | `observeApplications(javax.enterprise.inject.spi.ProcessAnnotatedType<T> event, javax.enterprise.inject.spi.BeanManager beanManager)` Set a default scope for each CDI bean which is a JAX-RS Application subclass.
    `void` | `observeBeforeBeanDiscovery(javax.enterprise.inject.spi.BeforeBeanDiscovery event, javax.enterprise.inject.spi.BeanManager beanManager)` Obtain BeanManager reference for future use.
    `<T> void` | `observeInjectionTarget(javax.enterprise.inject.spi.ProcessInjectionTarget<T> event)` Wrap InjectionTarget of JAX-RS components within JaxrsInjectionTarget which takes care of JAX-RS property injection.
    `<T> void` | `observeProviders(javax.enterprise.inject.spi.ProcessAnnotatedType<T> event, javax.enterprise.inject.spi.BeanManager beanManager)` Set a default scope for each CDI bean which is a JAX-RS Provider.
    `<T> void` | `observeResources(javax.enterprise.inject.spi.ProcessAnnotatedType<T> event, javax.enterprise.inject.spi.BeanManager beanManager)` Set a default scope for each CDI bean which is a JAX-RS Resource.
    `<T> void` | `observeSessionBeans(javax.enterprise.inject.spi.ProcessSessionBean<T> event)` Observes ProcessSessionBean events and creates a (Bean class -> Local interface) map for Session beans with local interfaces.
    `protected <T> javax.enterprise.inject.spi.AnnotatedType<T>` | `wrapAnnotatedType(javax.enterprise.inject.spi.AnnotatedType<T> type, Annotation scope)`
    `protected <T> javax.enterprise.inject.spi.InjectionTarget<T>` | `wrapInjectionTarget(javax.enterprise.inject.spi.ProcessInjectionTarget<T> event)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### requestScopedLiteral

          public static final Annotation requestScopedLiteral

    - #### applicationScopedLiteral

          public static final Annotation applicationScopedLiteral

  - ### Constructor Detail

    - #### ResteasyCdiExtension

          public ResteasyCdiExtension()

  - ### Method Detail

    - #### isCDIActive

          public static boolean isCDIActive()

    - #### observeBeforeBeanDiscovery

          public void observeBeforeBeanDiscovery(@Observes
                                        javax.enterprise.inject.spi.BeforeBeanDiscovery event,
                                        javax.enterprise.inject.spi.BeanManager beanManager)

      Obtain BeanManager reference for future use.

    - #### observeResources

          public <T> void observeResources(@Observes
                                  javax.enterprise.inject.spi.ProcessAnnotatedType<T> event,
                                  javax.enterprise.inject.spi.BeanManager beanManager)

      Set a default scope for each CDI bean which is a JAX-RS Resource.
      Parameters:
        `event` -
        `beanManager` -

    - #### observeProviders

          public <T> void observeProviders(@Observes
                                  javax.enterprise.inject.spi.ProcessAnnotatedType<T> event,
                                  javax.enterprise.inject.spi.BeanManager beanManager)

      Set a default scope for each CDI bean which is a JAX-RS Provider.
      Parameters:
        `event` -
        `beanManager` -

    - #### observeApplications

          public <T extends Application> void observeApplications(@Observes
                                                         javax.enterprise.inject.spi.ProcessAnnotatedType<T> event,
                                                         javax.enterprise.inject.spi.BeanManager beanManager)

      Set a default scope for each CDI bean which is a JAX-RS Application subclass.
      Parameters:
        `event` -
        `beanManager` -

    - #### wrapAnnotatedType

          protected <T> javax.enterprise.inject.spi.AnnotatedType<T> wrapAnnotatedType(javax.enterprise.inject.spi.AnnotatedType<T> type,
                                                                           Annotation scope)

    - #### observeInjectionTarget

          public <T> void observeInjectionTarget(@Observes
                                        javax.enterprise.inject.spi.ProcessInjectionTarget<T> event)

      Wrap InjectionTarget of JAX-RS components within JaxrsInjectionTarget which takes care of JAX-RS property injection.

    - #### wrapInjectionTarget

          protected <T> javax.enterprise.inject.spi.InjectionTarget<T> wrapInjectionTarget(javax.enterprise.inject.spi.ProcessInjectionTarget<T> event)

    - #### observeSessionBeans

          public <T> void observeSessionBeans(@Observes
                                     javax.enterprise.inject.spi.ProcessSessionBean<T> event)

      Observes ProcessSessionBean events and creates a (Bean class -> Local interface) map for Session beans with local interfaces. This map is necessary since RESTEasy identifies a bean class as JAX-RS components while CDI requires a local interface to be used for lookup.

    - #### getSessionBeanInterface

          public Map<Class<?>,Type> getSessionBeanInterface()

    - #### getProviders

          public List<Class> getProviders()

    - #### getResources

          public List<Class> getResources()

Copyright © 2014. All Rights Reserved.