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 void
close()
Delegates todestroy()
if the handle does not represent a CDI contextual instance or if it represents aDependent
CDI contextual instance.default void
destroy()
Destroy the instance as defined byContextual.destroy(Object, jakarta.enterprise.context.spi.CreationalContext)
.T
get()
default InjectableBean<T>
getBean()
default boolean
isAvailable()
default T
orElse(T other)
If an instance is available, returns the value, otherwise returnsother
.
-
-
-
Method Detail
-
get
T get()
- Specified by:
get
in interfacejakarta.enterprise.inject.Instance.Handle<T>
- Returns:
- an instance of
T
ornull
-
isAvailable
default boolean isAvailable()
- Returns:
true
if an instance is available,false
otherwise
-
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:
destroy
in interfacejakarta.enterprise.inject.Instance.Handle<T>
- See Also:
AlterableContext.destroy(jakarta.enterprise.context.spi.Contextual)
-
getBean
default InjectableBean<T> getBean()
- Specified by:
getBean
in 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 aDependent
CDI contextual instance.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacejakarta.enterprise.inject.Instance.Handle<T>
-
-