Class CdiComponentProvider


  • public class CdiComponentProvider
    extends ComponentProvider
    Provides the instance for CDI class.
    Author:
    Stepan Kopriva (stepan.kopriva at oracle.com)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> java.lang.Object create​(java.lang.Class<T> c)
      Create new instance.
      boolean destroy​(java.lang.Object o)
      Destroys the given managed instance.
      boolean isApplicable​(java.lang.Class<?> c)
      Checks whether this component provider is able to provide an instance of given Class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CdiComponentProvider

        public CdiComponentProvider()
                             throws javax.naming.NamingException
        Constructor.

        Looks up the BeanManager which is later used to provide the instance.

        Throws:
        javax.naming.NamingException - when Bean Manager cannot be looked up.
    • Method Detail

      • isApplicable

        public boolean isApplicable​(java.lang.Class<?> c)
        Description copied from class: ComponentProvider
        Checks whether this component provider is able to provide an instance of given Class.
        Specified by:
        isApplicable in class ComponentProvider
        Parameters:
        c - Class to be checked.
        Returns:
        true iff this ComponentProvider is able to create an instance of the given Class.
      • create

        public <T> java.lang.Object create​(java.lang.Class<T> c)
        Description copied from class: ComponentProvider
        Create new instance.
        Specified by:
        create in class ComponentProvider
        Type Parameters:
        T - type of the created object.
        Parameters:
        c - Class to be created.
        Returns:
        instance, iff found, null otherwise.
      • destroy

        public boolean destroy​(java.lang.Object o)
        Description copied from class: ComponentProvider
        Destroys the given managed instance.
        Specified by:
        destroy in class ComponentProvider
        Parameters:
        o - instance to be destroyed.
        Returns:
        true iff the instance was coupled to this ComponentProvider, false otherwise.