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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default 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).Tget()default InjectableBean<T>getBean()default booleanisAvailable()default TorElse(T other)If an instance is available, returns the value, otherwise returnsother.
-
-
-
Method Detail
-
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
default T orElse(T other)
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
default InjectableBean<T> 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>
-
-