Class 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
    • Field Detail

      • knownClassNames

        protected final Set<String> knownClassNames
    • Constructor Detail

      • AbstractCDI

        public AbstractCDI()
    • Method Detail

      • 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>
      • 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>
      • getPriorityComparator

        public Comparator<org.jboss.weld.inject.WeldInstance.Handler<?>> getPriorityComparator()
        Specified by:
        getPriorityComparator 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.