Package org.jboss.resteasy.cdi

## Class CdiConstructorInjector

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

- All Implemented Interfaces:
    `ConstructorInjector`

      public class CdiConstructorInjector
      extends Object
      implements ConstructorInjector

  This ConstructorInjector implementation uses CDI's BeanManager to obtain a contextual instance of a bean.
  Author:
    Jozef Hartinger

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CdiConstructorInjector​(Type type, javax.enterprise.inject.spi.BeanManager manager)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Object` | `construct​(boolean unwrapAsync)` | Construct outside the scope of an HTTP request.
    `Object` | `construct​(HttpRequest request, HttpResponse response, boolean unwrapAsync)` | Construct inside the scope of an HTTP request.
    `Object` | `injectableArguments​(boolean unwrapAsync)` | Create an arguments list from injectable tings outside the scope of an HTTP request.
    `Object` | `injectableArguments​(HttpRequest request, HttpResponse response, boolean unwrapAsync)` | Create an argument list inside the scope of an HTTP request.

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

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

- - ### Constructor Detail

    - #### CdiConstructorInjector

          public CdiConstructorInjector​(Type type,
                                        javax.enterprise.inject.spi.BeanManager manager)

  - ### Method Detail

    - #### construct

          public Object construct​(boolean unwrapAsync)

      Description copied from interface: `ConstructorInjector`
      Construct outside the scope of an HTTP request. Useful for singleton factories.
      Specified by:
        `construct` in interface `ConstructorInjector`
      Parameters:
        `unwrapAsync` - unwrap async
      Returns:
        constructed object or a CompletionStage

    - #### construct

          public Object construct​(HttpRequest request,
                                  HttpResponse response,
                                  boolean unwrapAsync)
                           throws Failure,
                                  javax.ws.rs.WebApplicationException,
                                  ApplicationException

      Description copied from interface: `ConstructorInjector`
      Construct inside the scope of an HTTP request.
      Specified by:
        `construct` in interface `ConstructorInjector`
      Parameters:
        `request` - http request
        `response` - http response
        `unwrapAsync` - unwrap async
      Returns:
        constructed object or a CompletionStage
      Throws:
        `Failure` - if failure occurred
        `javax.ws.rs.WebApplicationException` - if application exception occurred
        `ApplicationException` - if application exception occurred

    - #### injectableArguments

          public Object injectableArguments​(boolean unwrapAsync)

      Description copied from interface: `ConstructorInjector`
      Create an arguments list from injectable tings outside the scope of an HTTP request. Useful for singleton factories in cases where the resource factory wants to allocate the object itself, but wants resteasy to populate the arguments.
      Specified by:
        `injectableArguments` in interface `ConstructorInjector`
      Parameters:
        `unwrapAsync` - unwrap async
      Returns:
        array of arguments or a CompletionStage if args is async

    - #### injectableArguments

          public Object injectableArguments​(HttpRequest request,
                                            HttpResponse response,
                                            boolean unwrapAsync)
                                     throws Failure

      Description copied from interface: `ConstructorInjector`
      Create an argument list inside the scope of an HTTP request. Useful in cases where the resource factory wants to allocate the object itself, but wants resteasy to populate the arguments.
      Specified by:
        `injectableArguments` in interface `ConstructorInjector`
      Parameters:
        `request` - http request
        `response` - http response
        `unwrapAsync` - unwrap async
      Returns:
        array of arguments or a CompletionStage if args is async
      Throws:
        `Failure` - if failure occurred