Interface WeldInstance.Handler<T>

  • Type Parameters:
    T - the required bean type
    All Superinterfaces:
    AutoCloseable, jakarta.enterprise.inject.Instance.Handle<T>
    Enclosing interface:
    WeldInstance<T>

    @Deprecated
    public static interface WeldInstance.Handler<T>
    extends jakarta.enterprise.inject.Instance.Handle<T>
    Deprecated.
    This interface is deprecated. CDI 4.0 introduced Instance.Handle interface that offers the same functionality and can be used in place of Weld specific WeldInstance.Handler. This interface represents a contextual reference handler.

    Allows to inspect the metadata of the relevant bean and also to destroy the underlying contextual instance.

    Author:
    Martin Kouba
    • Method Detail

      • get

        T get()
        Deprecated.
        The contextual reference is obtained lazily, i.e. when first needed.
        Specified by:
        get in interface jakarta.enterprise.inject.Instance.Handle<T>
        Returns:
        the contextual reference
        Throws:
        IllegalStateException - If the producing WeldInstance does not exist
        See Also:
        Provider.get()
      • getBean

        jakarta.enterprise.inject.spi.Bean<T> getBean()
        Deprecated.
        Specified by:
        getBean in interface jakarta.enterprise.inject.Instance.Handle<T>
        Returns:
        the bean metadata
      • destroy

        void destroy()
        Deprecated.
        Destroy the contextual instance. It's a no-op if:
        • called multiple times
        • if the producing WeldInstance does not exist
        • if the handler does not hold a contextual reference, i.e. get() was never called
        Specified by:
        destroy in interface jakarta.enterprise.inject.Instance.Handle<T>
        See Also:
        Instance.destroy(Object)
      • close

        void close()
        Deprecated.
        Delegates to destroy().
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface jakarta.enterprise.inject.Instance.Handle<T>