Class AbstractCDI<T>

java.lang.Object
jakarta.enterprise.inject.spi.CDI<T>
org.jboss.weld.AbstractCDI<T>
Type Parameters:
T -
All Implemented Interfaces:
jakarta.enterprise.inject.Instance<T>, jakarta.inject.Provider<T>, Iterable<T>, org.jboss.weld.inject.WeldInstance<T>
Direct Known Subclasses:
SimpleCDI

public abstract class AbstractCDI<T> extends jakarta.enterprise.inject.spi.CDI<T> implements org.jboss.weld.inject.WeldInstance<T>
Abstract implementation of CDI which forwards all Instance methods to a delegate. Furthermore, it allows the calling class to be identified using the getCallingClassName() method.
Author:
Jozef Hartinger
  • Nested Class Summary

    Nested classes/interfaces inherited from interface jakarta.enterprise.inject.Instance

    jakarta.enterprise.inject.Instance.Handle<T extends Object>

    Nested classes/interfaces inherited from interface org.jboss.weld.inject.WeldInstance

    org.jboss.weld.inject.WeldInstance.Handler<T extends Object>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Set<String>
     

    Fields inherited from class jakarta.enterprise.inject.spi.CDI

    configuredProvider, discoveredProviders
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Check whether the container is in a "valid" state, no-op by default.
    void
    destroy(T instance)
     
    get()
     
    protected String
    Examines StackTraceElements to figure out which class invoked a method on CDI.
    jakarta.enterprise.inject.Instance.Handle<T>
     
    Comparator<jakarta.enterprise.inject.Instance.Handle<?>>
     
    org.jboss.weld.inject.WeldInstance.Handler<T>
     
    protected org.jboss.weld.inject.WeldInstance<T>
    Subclasses are allowed to override the default behavior, i.e. to cache an instance per BeanManager.
    Comparator<org.jboss.weld.inject.WeldInstance.Handler<?>>
     
    Iterable<org.jboss.weld.inject.WeldInstance.Handler<T>>
     
    Iterable<? extends jakarta.enterprise.inject.Instance.Handle<T>>
     
    boolean
     
    boolean
     
    boolean
     
     
    <U extends T>
    org.jboss.weld.inject.WeldInstance<U>
    select(jakarta.enterprise.util.TypeLiteral<U> subtype, Annotation... qualifiers)
     
    org.jboss.weld.inject.WeldInstance<T>
    select(Annotation... qualifiers)
     
    <U extends T>
    org.jboss.weld.inject.WeldInstance<U>
    select(Class<U> subtype, Annotation... qualifiers)
     
    <X> org.jboss.weld.inject.WeldInstance<X>
    select(Type subtype, Annotation... qualifiers)
     

    Methods inherited from class jakarta.enterprise.inject.spi.CDI

    current, getBeanContainer, getBeanManager, setCDIProvider

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface jakarta.enterprise.inject.Instance

    handlesStream, stream

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.jboss.weld.inject.WeldInstance

    handlersStream
  • Field Details

    • knownClassNames

      protected final Set<String> knownClassNames
  • Constructor Details

    • AbstractCDI

      public AbstractCDI()
  • Method Details

    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • get

      public T get()
      Specified by:
      get in interface jakarta.inject.Provider<T>
    • select

      public org.jboss.weld.inject.WeldInstance<T> select(Annotation... qualifiers)
      Specified by:
      select in interface jakarta.enterprise.inject.Instance<T>
      Specified by:
      select in interface org.jboss.weld.inject.WeldInstance<T>
    • select

      public <U extends T> org.jboss.weld.inject.WeldInstance<U> select(Class<U> subtype, Annotation... qualifiers)
      Specified by:
      select in interface jakarta.enterprise.inject.Instance<T>
      Specified by:
      select in interface org.jboss.weld.inject.WeldInstance<T>
    • select

      public <U extends T> org.jboss.weld.inject.WeldInstance<U> select(jakarta.enterprise.util.TypeLiteral<U> subtype, Annotation... qualifiers)
      Specified by:
      select in interface jakarta.enterprise.inject.Instance<T>
      Specified by:
      select in interface org.jboss.weld.inject.WeldInstance<T>
    • select

      public <X> org.jboss.weld.inject.WeldInstance<X> select(Type subtype, Annotation... qualifiers)
      Specified by:
      select in interface org.jboss.weld.inject.WeldInstance<T>
    • isUnsatisfied

      public boolean isUnsatisfied()
      Specified by:
      isUnsatisfied in interface jakarta.enterprise.inject.Instance<T>
    • isAmbiguous

      public boolean isAmbiguous()
      Specified by:
      isAmbiguous in interface jakarta.enterprise.inject.Instance<T>
    • destroy

      public void destroy(T instance)
      Specified by:
      destroy in interface jakarta.enterprise.inject.Instance<T>
    • getHandler

      public org.jboss.weld.inject.WeldInstance.Handler<T> getHandler()
      Specified by:
      getHandler in interface org.jboss.weld.inject.WeldInstance<T>
    • getHandle

      public jakarta.enterprise.inject.Instance.Handle<T> getHandle()
      Specified by:
      getHandle in interface jakarta.enterprise.inject.Instance<T>
    • isResolvable

      public boolean isResolvable()
      Specified by:
      isResolvable in interface jakarta.enterprise.inject.Instance<T>
    • handlers

      public Iterable<org.jboss.weld.inject.WeldInstance.Handler<T>> handlers()
      Specified by:
      handlers in interface org.jboss.weld.inject.WeldInstance<T>
    • handles

      public Iterable<? extends jakarta.enterprise.inject.Instance.Handle<T>> handles()
      Specified by:
      handles in interface jakarta.enterprise.inject.Instance<T>
    • getPriorityComparator

      public Comparator<org.jboss.weld.inject.WeldInstance.Handler<?>> getPriorityComparator()
      Specified by:
      getPriorityComparator in interface org.jboss.weld.inject.WeldInstance<T>
    • getHandlePriorityComparator

      public Comparator<jakarta.enterprise.inject.Instance.Handle<?>> getHandlePriorityComparator()
      Specified by:
      getHandlePriorityComparator in interface org.jboss.weld.inject.WeldInstance<T>
    • getCallingClassName

      protected String getCallingClassName()
      Examines StackTraceElements to figure out which class invoked a method on CDI.
    • getInstance

      protected org.jboss.weld.inject.WeldInstance<T> getInstance()
      Subclasses are allowed to override the default behavior, i.e. to cache an instance per BeanManager.
      Returns:
      the Instance the relevant calls are delegated to
    • checkState

      protected void checkState()
      Check whether the container is in a "valid" state, no-op by default.

      Subclasses are allowed to override the default behavior, i.e. to check whether a container is running.