Package io.quarkus.arc
Interface InstanceHandle<T>
- Type Parameters:
T-
- All Superinterfaces:
AutoCloseable,jakarta.enterprise.inject.Instance.Handle<T>
- All Known Subinterfaces:
ContextInstanceHandle<T>
- All Known Implementing Classes:
ContextInstanceHandleImpl
public interface InstanceHandle<T>
extends AutoCloseable, jakarta.enterprise.inject.Instance.Handle<T>
Represents an instance handle.
- Author:
- Martin Kouba
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Delegates todestroy()if the handle does not represent a CDI contextual instance or if it represents aDependentCDI contextual instance.default voiddestroy()Destroy the instance as defined byContextual.destroy(Object, jakarta.enterprise.context.spi.CreationalContext).get()default InjectableBean<T>getBean()default booleandefault TIf an instance is available, returns the value, otherwise returnsother.
-
Method Details
-
get
T get()- Specified by:
getin interfacejakarta.enterprise.inject.Instance.Handle<T>- Returns:
- an instance of
Tornull
-
isAvailable
default boolean isAvailable()- Returns:
trueif an instance is available,falseotherwise
-
orElse
If an instance is available, returns the value, otherwise returnsother.- Parameters:
other-- Returns:
- the instance if available, otherwise
other
-
destroy
default void destroy()Destroy the instance as defined byContextual.destroy(Object, jakarta.enterprise.context.spi.CreationalContext). If this is a CDI contextual instance, it is also removed from the underlying context.- Specified by:
destroyin interfacejakarta.enterprise.inject.Instance.Handle<T>- See Also:
-
AlterableContext.destroy(jakarta.enterprise.context.spi.Contextual)
-
getBean
- Specified by:
getBeanin interfacejakarta.enterprise.inject.Instance.Handle<T>- Returns:
- the injectable bean for a CDI contextual instance or
null
-
close
default void close()Delegates todestroy()if the handle does not represent a CDI contextual instance or if it represents aDependentCDI contextual instance.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacejakarta.enterprise.inject.Instance.Handle<T>
-