Class CDI<T>

  • All Implemented Interfaces:
    java.lang.Iterable<T>, Instance<T>, Provider<T>


    public abstract class CDI<T>
    extends java.lang.Object
    implements Instance<T>
    Provides access to the current container.
    Since:
    1.1
    • Field Detail

      • discoveredProviders

        protected static volatile java.util.Set<CDIProvider> discoveredProviders
      • configuredProvider

        protected static volatile CDIProvider configuredProvider
    • Constructor Detail

      • CDI

        public CDI​()
    • Method Detail

      • current

        public static CDI<java.lang.Object> current​()

        Get the CDI instance that provides access to the current container.

        If there are no providers available, an IllegalStateException is thrown, otherwise the first provider which can access the container is used.

        Throws:
        java.lang.IllegalStateException - if no CDI provider is available
      • setCDIProvider

        public static void setCDIProvider​(CDIProvider provider)

        Set the CDIProvider to use.

        If a CDIProvider is set using this method, any provider specified as a service provider will not be used.

        Parameters:
        provider - the provider to use
        Throws:
        java.lang.IllegalStateException - if the CDIProvider is already set
      • getBeanManager

        public abstract BeanManager getBeanManager​()
        Get the CDI BeanManager for the current context
        Returns: