Package org.apache.myfaces.cdi.view
Class ViewScopeBeanHolder
- java.lang.Object
-
- org.apache.myfaces.cdi.view.ViewScopeBeanHolder
-
- All Implemented Interfaces:
Serializable
@SessionScoped public class ViewScopeBeanHolder extends Object implements Serializable
- Author:
- Leonardo Uribe
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ViewScopeBeanHolder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroyBeans()
This method properly destroys all current @WindowScoped beans of the active session and also prepares the storage for new beans.void
destroyBeans(String viewScopeId)
void
destroyBeansOnPreDestroy()
Map<String,ViewScopeContextualStorage>
forceNewStorage()
This method will replace the storageMap and with a new empty one.String
generateUniqueViewScopeId()
ViewScopeContextualStorage
getContextualStorage(javax.enterprise.inject.spi.BeanManager beanManager, String viewScopeId)
This method will return the ViewScopeContextualStorage or create a new one if no one is yet assigned to the current windowId.Map<String,ViewScopeContextualStorage>
getStorageMap()
void
init()
void
removeStorage(String viewScopeId)
-
-
-
Field Detail
-
CREATED
public static final String CREATED
-
-
Method Detail
-
init
@PostConstruct public void init()
-
getContextualStorage
public ViewScopeContextualStorage getContextualStorage(javax.enterprise.inject.spi.BeanManager beanManager, String viewScopeId)
This method will return the ViewScopeContextualStorage or create a new one if no one is yet assigned to the current windowId.- Parameters:
beanManager
-viewScopeId
-- Returns:
-
getStorageMap
public Map<String,ViewScopeContextualStorage> getStorageMap()
-
forceNewStorage
public Map<String,ViewScopeContextualStorage> forceNewStorage()
This method will replace the storageMap and with a new empty one. This method can be used to properly destroy the BeanHolder beans without having to sync heavily. AnyContextual.destroy(Object, javax.enterprise.context.spi.CreationalContext)
should be performed on the returned old storage map.- Returns:
- the old storageMap.
-
destroyBeans
public void destroyBeans()
This method properly destroys all current @WindowScoped beans of the active session and also prepares the storage for new beans. It will automatically get called when the session context closes but can also get invoked manually, e.g. if a user likes to get rid of all it's @ViewScoped beans.
-
destroyBeans
public void destroyBeans(String viewScopeId)
-
destroyBeansOnPreDestroy
@PreDestroy public void destroyBeansOnPreDestroy()
-
generateUniqueViewScopeId
public String generateUniqueViewScopeId()
-
removeStorage
public void removeStorage(String viewScopeId)
-
-