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 void
close()
Delegates todestroy()
.void
destroy()
Destroy the contextual instance.T
get()
The contextual reference is obtained lazily, i.e.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 producingWeldInstance
does not exist- See Also:
Provider.get()
-
getBean
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
WeldInstance
does 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:
close
in interfaceAutoCloseable
-
-