Class AbstractCDI<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    Iterable<T>, javax.enterprise.inject.Instance<T>, javax.inject.Provider<T>
    Direct Known Subclasses:
    SimpleCDI, WeldContainer

    public abstract class AbstractCDI<T>
    extends javax.enterprise.inject.spi.CDI<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()
      • select

        public javax.enterprise.inject.Instance<T> select​(Annotation... qualifiers)
      • select

        public <U extends T> javax.enterprise.inject.Instance<U> select​(Class<U> subtype,
                                                                        Annotation... qualifiers)
      • select

        public <U extends T> javax.enterprise.inject.Instance<U> select​(javax.enterprise.util.TypeLiteral<U> subtype,
                                                                        Annotation... qualifiers)
      • isUnsatisfied

        public boolean isUnsatisfied()
      • isAmbiguous

        public boolean isAmbiguous()
      • destroy

        public void destroy​(T instance)
      • getCallingClassName

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

        protected javax.enterprise.inject.Instance<T> getInstance()
        Subclasses are allowed to override the default behavior, i.e. to cache instance per BeanManager.
        Returns:
        the Instance the relevant calls are delegated to