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 void
close()
Delegates todestroy()
.void
destroy()
Destroy the contextual instance.T
get()
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 producingInstance
does not existIllegalStateException
- If invoked onInstance.Handle
that 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:
close
in interfaceAutoCloseable
-
-