Class SupplierClassBean<T>

java.lang.Object
org.glassfish.jersey.inject.weld.internal.bean.JerseyBean<Supplier<T>>
org.glassfish.jersey.inject.weld.internal.bean.SupplierClassBean<T>
All Implemented Interfaces:
jakarta.enterprise.context.spi.Contextual<Supplier<T>>, jakarta.enterprise.inject.spi.Bean<Supplier<T>>, jakarta.enterprise.inject.spi.BeanAttributes<Supplier<T>>, jakarta.enterprise.inject.spi.PassivationCapable

public class SupplierClassBean<T> extends JerseyBean<Supplier<T>>
Creates an implementation of Bean interface using Jersey's SupplierClassBinding. Binding provides the information about the bean also called BeanAttributes information and JerseyInjectionTarget provides the contextual part of the bean because implements Contextual with Jersey injection extension (is able to inject into JAX-RS/Jersey specified annotation).

Bean's implementation provides possibility to register Supplier and DisposableSupplier.

Inject example:

 AbstractBinder {
     @Override
     protected void configure() {
         bindFactory(MyBeanSupplier.class)
              .to(MyBean.class)
              .in(Singleton.class);
     }
 }
 
Register example:
  @Path("/")
  public class MyResource {
    @Inject
    private Supplier<MyBean> myBean;
  }
 
Author:
Petr Bouda
  • Method Details

    • getScope

      public Class<? extends Annotation> getScope()
      Specified by:
      getScope in interface jakarta.enterprise.inject.spi.BeanAttributes<T>
      Overrides:
      getScope in class JerseyBean<Supplier<T>>
    • getTypes

      public Set<Type> getTypes()
      Specified by:
      getTypes in interface jakarta.enterprise.inject.spi.BeanAttributes<T>
      Overrides:
      getTypes in class JerseyBean<Supplier<T>>
    • create

      public Supplier<T> create(jakarta.enterprise.context.spi.CreationalContext<Supplier<T>> context)
    • destroy

      public void destroy(Supplier<T> instance, jakarta.enterprise.context.spi.CreationalContext<Supplier<T>> context)
      Specified by:
      destroy in interface jakarta.enterprise.context.spi.Contextual<T>
      Overrides:
      destroy in class JerseyBean<Supplier<T>>
    • getBeanClass

      public Class<?> getBeanClass()
      Specified by:
      getBeanClass in interface jakarta.enterprise.inject.spi.Bean<T>
      Overrides:
      getBeanClass in class JerseyBean<Supplier<T>>
    • getInjectionTarget

      public jakarta.enterprise.inject.spi.InjectionTarget<Supplier<T>> getInjectionTarget()