Package org.jboss.weld.inject
Interface WeldInstance.Handler<T>
-
- Type Parameters:
T- the required bean type
- All Superinterfaces:
AutoCloseable
- Enclosing interface:
- WeldInstance<T>
public static interface WeldInstance.Handler<T> extends AutoCloseable
This interface represents a contextual reference handler.Allows to inspect the metadata of the relevant bean and also to destroy the underlying contextual instance.
- Author:
- Martin Kouba
-
-
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.javax.enterprise.inject.spi.Bean<?>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 producingWeldInstancedoes not exist- See Also:
Provider.get()
-
getBean
javax.enterprise.inject.spi.Bean<?> getBean()
- Returns:
- the bean metadata
-
destroy
void destroy()
Destroy the contextual instance. It's a no-op if:- called multiple times
- if the producing
WeldInstancedoes not exist - if the handler does not hold a contextual reference, i.e.
get()was never called
- See Also:
Instance.destroy(Object)
-
close
void close()
Delegates todestroy().- Specified by:
closein interfaceAutoCloseable
-
-