Package org.apache.myfaces.cdi.view
Class ViewScopeContext
- java.lang.Object
-
- org.apache.myfaces.cdi.view.ViewScopeContext
-
- All Implemented Interfaces:
javax.enterprise.context.spi.Context
@Typed public class ViewScopeContext extends Object implements javax.enterprise.context.spi.Context
CDI Context to handle @ViewScopedbeans.- Author:
- Leonardo Uribe
-
-
Constructor Summary
Constructors Constructor Description ViewScopeContext(javax.enterprise.inject.spi.BeanManager beanManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckActive()Make sure that the Context is really active.booleandestroy(javax.enterprise.context.spi.Contextual bean)Destroy the Contextual Instance of the given Bean.voiddestroyAllActive()destroys all the Contextual Instances in the Storage returned bygetContextualStorage(boolean).static voiddestroyAllActive(ViewScopeContextualStorage storage)static voiddestroyAllActive(ViewScopeContextualStorage storage, FacesContext facesContext)<T> Tget(javax.enterprise.context.spi.Contextual<T> bean)<T> Tget(javax.enterprise.context.spi.Contextual<T> bean, javax.enterprise.context.spi.CreationalContext<T> creationalContext)protected ViewScopeContextualStoragegetContextualStorage(boolean createIfNotExist)StringgetCurrentViewScopeId(boolean create)Class<? extends Annotation>getScope()protected ViewScopeBeanHoldergetViewScopeBeanHolder()protected ViewScopeBeanHoldergetViewScopeBeanHolder(FacesContext facesContext)booleanisActive()The WindowContext is active once a current windowId is set for the current Thread.
-
-
-
Method Detail
-
getViewScopeBeanHolder
protected ViewScopeBeanHolder getViewScopeBeanHolder()
-
getViewScopeBeanHolder
protected ViewScopeBeanHolder getViewScopeBeanHolder(FacesContext facesContext)
-
getCurrentViewScopeId
public String getCurrentViewScopeId(boolean create)
-
getContextualStorage
protected ViewScopeContextualStorage getContextualStorage(boolean createIfNotExist)
-
getScope
public Class<? extends Annotation> getScope()
- Specified by:
getScopein interfacejavax.enterprise.context.spi.Context
-
isActive
public boolean isActive()
The WindowContext is active once a current windowId is set for the current Thread.- Specified by:
isActivein interfacejavax.enterprise.context.spi.Context- Returns:
-
get
public <T> T get(javax.enterprise.context.spi.Contextual<T> bean)
- Specified by:
getin interfacejavax.enterprise.context.spi.Context
-
get
public <T> T get(javax.enterprise.context.spi.Contextual<T> bean, javax.enterprise.context.spi.CreationalContext<T> creationalContext)- Specified by:
getin interfacejavax.enterprise.context.spi.Context
-
destroy
public boolean destroy(javax.enterprise.context.spi.Contextual bean)
Destroy the Contextual Instance of the given Bean.- Parameters:
bean- dictates which bean shall get cleaned up- Returns:
trueif the bean was destroyed,falseif there was no such bean.
-
destroyAllActive
public void destroyAllActive()
destroys all the Contextual Instances in the Storage returned bygetContextualStorage(boolean).
-
destroyAllActive
public static void destroyAllActive(ViewScopeContextualStorage storage)
-
destroyAllActive
public static void destroyAllActive(ViewScopeContextualStorage storage, FacesContext facesContext)
-
checkActive
protected void checkActive()
Make sure that the Context is really active.- Throws:
javax.enterprise.context.ContextNotActiveException- if there is no active Context for the current Thread.
-
-