Package jakarta.enterprise.inject
Interface Instance.Handle<T>
-
- Type Parameters:
T- the required bean type
- All Superinterfaces:
AutoCloseable
public static interface Instance.Handle<T> extends AutoCloseable
This interface represents a contextual reference handle.Allows to inspect the metadata of the relevant bean before resolving its contextual reference and also to destroy the underlying contextual instance.
- Author:
- Matej Novotny
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Delegates todestroy().voiddestroy()Destroy the contextual instance.Tget()The contextual reference is obtained lazily, i.e.Bean<T>getBean()
-
-
-
Method Detail
-
get
T get()
The contextual reference is obtained lazily, i.e. when first needed.- Returns:
- the contextual reference
- Throws:
IllegalStateException- If the producingInstancedoes not existIllegalStateException- If invoked onInstance.Handlethat previously successfully destroyed its underlying contextual reference- See Also:
Provider.get()
-
destroy
void destroy()
Destroy the contextual instance. It's a no-op if:- See Also:
Instance.destroy(Object)
-
close
void close()
Delegates todestroy().- Specified by:
closein interfaceAutoCloseable
-
-