public interface Context
@ScopeType.
The Context is an SPI class, called by
the inject
Manager, but not normally by application code. Applications will call
BeanManager.newInstance to
create a new instance of a bean.
Example contexts include @ApplicationScoped for singleton objects,| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(Contextual<T> bean)
Returns a instance of a bean, creating if the bean is not already
available in the context.
|
<T> T |
get(Contextual<T> bean,
CreationalContext<T> creationalContext)
Internal SPI method to create a new instance of a bean, when given
a creational context.
|
java.lang.Class<? extends java.lang.annotation.Annotation> |
getScope()
Returns the @ScopeType corresponding to the current context.
|
boolean |
isActive()
Returns true if the scope is currently active.
|
java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
boolean isActive()
<T> T get(Contextual<T> bean)
bean - the Bean type to be created<T> T get(Contextual<T> bean, CreationalContext<T> creationalContext)
bean - the Bean type to be createdcreationalContext - - temporary context used for managing
circular references