Interface InstanceHandle<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void close()
      Delegates to destroy() if the handle does not represent a CDI contextual instance or if it represents a Dependent CDI contextual instance.
      default void destroy()
      Destroy the instance as defined by Contextual.destroy(Object, javax.enterprise.context.spi.CreationalContext).
      T get()  
      default InjectableBean<T> getBean()  
      default boolean isAvailable()  
      default T orElse​(T other)
      If an instance is available, returns the value, otherwise returns other.
    • Method Detail

      • get

        T get()
        Returns:
        an instance of T or null
      • isAvailable

        default boolean isAvailable()
        Returns:
        true if an instance is available, false otherwise
      • orElse

        default T orElse​(T other)
        If an instance is available, returns the value, otherwise returns other.
        Parameters:
        other -
        Returns:
        the instance if available, otherwise other
      • destroy

        default void destroy()
        Destroy the instance as defined by Contextual.destroy(Object, javax.enterprise.context.spi.CreationalContext). If this is a CDI contextual instance it is also removed from the underlying context.
        See Also:
        AlterableContext.destroy(javax.enterprise.context.spi.Contextual)
      • getBean

        default InjectableBean<T> getBean()
        Returns:
        the injectable bean for a CDI contextual instance or null
      • close

        default void close()
        Delegates to destroy() if the handle does not represent a CDI contextual instance or if it represents a Dependent CDI contextual instance.
        Specified by:
        close in interface AutoCloseable