Class JerseyInjectionTarget<T>

java.lang.Object
org.jboss.weld.injection.producer.AbstractProducer<T>
org.jboss.weld.injection.producer.BasicInjectionTarget<T>
org.glassfish.jersey.inject.cdi.se.injector.JerseyInjectionTarget<T>
All Implemented Interfaces:
jakarta.enterprise.inject.spi.InjectionTarget<T>, jakarta.enterprise.inject.spi.Producer<T>, org.jboss.weld.manager.api.WeldInjectionTarget<T>

public class JerseyInjectionTarget<T> extends org.jboss.weld.injection.producer.BasicInjectionTarget<T>
Wrapper for InjectionTarget that implements the functionality of injecting using JAX-RS annotations into provided instances. Delegate is a original InjectionTarget which is able to inject other fields/parameters which are managed by CDI.

Implementation is also able create with custom jerseyConstructor if it is provided. This functionality allows override default instantiator and use the Jersey-specific one.

Author:
Petr Bouda
  • Field Summary

    Fields inherited from class org.jboss.weld.injection.producer.BasicInjectionTarget

    beanManager
  • Constructor Summary

    Constructors
    Constructor
    Description
    JerseyInjectionTarget(org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType<T> annotatedType, org.jboss.weld.injection.producer.BasicInjectionTarget<T> delegate, jakarta.enterprise.inject.spi.Bean<T> bean, Class<T> clazz, Collection<org.glassfish.jersey.internal.inject.InjectionResolver> resolvers, org.jboss.weld.injection.producer.Instantiator<T> instantiator)
    Creates a new injection target which is able to delegate an injection to delegate injection target and inject the fields that are Jersey-specific.
    JerseyInjectionTarget(org.jboss.weld.injection.producer.BasicInjectionTarget<T> delegate, jakarta.enterprise.inject.spi.Bean<T> bean, Class<T> clazz, Collection<org.glassfish.jersey.internal.inject.InjectionResolver> resolvers)
    Creates a new injection target which is able to delegate an injection to delegate injection target and inject the fields that are Jersey-specific.
    JerseyInjectionTarget(org.jboss.weld.injection.producer.BasicInjectionTarget<T> delegate, Class<T> clazz)
    Creates a new injection target which is able to delegate an injection to delegate injection target and inject the fields that are Jersey-specific.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    jakarta.enterprise.inject.spi.Bean<T>
     
    org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType<T>
     
    void
    initializeAfterBeanDiscovery(org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType<T> annotatedType)
    Copied method from the parent class because of a custom type of Instantiator is used in this implementation.
    void
    inject(T instance, jakarta.enterprise.context.spi.CreationalContext<T> ctx)
     
    void
    setInjectionResolvers(Collection<org.glassfish.jersey.internal.inject.InjectionResolver> resolvers)
    In some cases Injection Resolvers cannot be provided during th creation of the object therefore must be set later on.

    Methods inherited from class org.jboss.weld.injection.producer.BasicInjectionTarget

    checkType, create, createDefault, createNonCdiInterceptor, dispose, getAnnotated, getAnnotatedType, getBeanManager, getInjectionPoints, getInjector, getInstantiator, getLifecycleCallbackInvoker, getType, hasDecorators, hasInterceptors, initInstantiator, postConstruct, preDestroy, produce, setInstantiator, toString

    Methods inherited from class org.jboss.weld.injection.producer.AbstractProducer

    equals, hashCode

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • JerseyInjectionTarget

      public JerseyInjectionTarget(org.jboss.weld.injection.producer.BasicInjectionTarget<T> delegate, Class<T> clazz)
      Creates a new injection target which is able to delegate an injection to delegate injection target and inject the fields that are Jersey-specific. The resolvers must be set later on. CDI will select its own constructor.
      Parameters:
      delegate - CDI specific injection target.
      clazz - class that will be scanned and injected.
    • JerseyInjectionTarget

      public JerseyInjectionTarget(org.jboss.weld.injection.producer.BasicInjectionTarget<T> delegate, jakarta.enterprise.inject.spi.Bean<T> bean, Class<T> clazz, Collection<org.glassfish.jersey.internal.inject.InjectionResolver> resolvers)
      Creates a new injection target which is able to delegate an injection to delegate injection target and inject the fields that are Jersey-specific. CDI will select its own constructor.
      Parameters:
      delegate - CDI specific injection target.
      bean - bean which this injection target belongs to.
      clazz - class that will be scanned and injected.
      resolvers - all resolvers that can provide a valued for Jersey-specific injection.
    • JerseyInjectionTarget

      public JerseyInjectionTarget(org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType<T> annotatedType, org.jboss.weld.injection.producer.BasicInjectionTarget<T> delegate, jakarta.enterprise.inject.spi.Bean<T> bean, Class<T> clazz, Collection<org.glassfish.jersey.internal.inject.InjectionResolver> resolvers, org.jboss.weld.injection.producer.Instantiator<T> instantiator)
      Creates a new injection target which is able to delegate an injection to delegate injection target and inject the fields that are Jersey-specific. This method accepts custom instantiator, if the instantiator is null default one is created.
      Parameters:
      annotatedType - resolved type of the registered bean.
      delegate - CDI specific injection target.
      bean - bean which this injection target belongs to.
      clazz - class that will be scanned and injected.
      resolvers - all resolvers that can provide a valued for Jersey-specific injection.
      instantiator - default instantiator.
  • Method Details

    • checkDelegateInjectionPoints

      protected void checkDelegateInjectionPoints()
      Overrides:
      checkDelegateInjectionPoints in class org.jboss.weld.injection.producer.AbstractProducer<T>
    • inject

      public void inject(T instance, jakarta.enterprise.context.spi.CreationalContext<T> ctx)
      Specified by:
      inject in interface jakarta.enterprise.inject.spi.InjectionTarget<T>
      Overrides:
      inject in class org.jboss.weld.injection.producer.BasicInjectionTarget<T>
    • initializeAfterBeanDiscovery

      public void initializeAfterBeanDiscovery(org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType<T> annotatedType)
      Copied method from the parent class because of a custom type of Instantiator is used in this implementation.
      Overrides:
      initializeAfterBeanDiscovery in class org.jboss.weld.injection.producer.BasicInjectionTarget<T>
      Parameters:
      annotatedType - processed class.
    • getBean

      public jakarta.enterprise.inject.spi.Bean<T> getBean()
      Overrides:
      getBean in class org.jboss.weld.injection.producer.BasicInjectionTarget<T>
    • setInjectionResolvers

      public void setInjectionResolvers(Collection<org.glassfish.jersey.internal.inject.InjectionResolver> resolvers)
      In some cases Injection Resolvers cannot be provided during th creation of the object therefore must be set later on.
      Parameters:
      resolvers - all registered injection resolvers.
    • getEnhancedAnnotatedType

      public org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType<T> getEnhancedAnnotatedType()