Package com.vaadin.cdi.context
Class VaadinServiceScopedContext.ContextualStorageManager
java.lang.Object
com.vaadin.cdi.context.VaadinServiceScopedContext.ContextualStorageManager
- All Implemented Interfaces:
Serializable
- Enclosing class:
VaadinServiceScopedContext
@ApplicationScoped
public static class VaadinServiceScopedContext.ContextualStorageManager
extends Object
Manages the contextual storages of Vaadin service scoped beans, keyed by
servlet name.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDestroys all active beans in the storage of the given key and removes the storage.protected voidDestroys all active beans in all managed storages and removes the storages.protected ContextualStoragegetContextualStorage(String key, boolean createIfNotExist) Gets the contextual storage for the given key.Gets the keys of all managed storages.protected ContextualStorageCreates a new contextual storage for the given key.protected voidMoves the contextual storage stored for one key to another key.
-
Constructor Details
-
ContextualStorageManager
public ContextualStorageManager()Creates a new storage manager.
-
-
Method Details
-
getContextualStorage
Gets the contextual storage for the given key.- Parameters:
key- the context keycreateIfNotExist- whether to create the storage if it does not exist yet- Returns:
- the contextual storage, or
nullif it does not exist andcreateIfNotExistisfalse
-
relocate
Moves the contextual storage stored for one key to another key. Does nothing if there is no storage for the source key.- Parameters:
from- the current key of the storageto- the new key of the storage
-
newContextualStorage
Creates a new contextual storage for the given key.- Parameters:
key- the context key- Returns:
- the new contextual storage
-
destroyAll
@PreDestroy protected void destroyAll()Destroys all active beans in all managed storages and removes the storages. -
destroy
Destroys all active beans in the storage of the given key and removes the storage.- Parameters:
key- the context key
-
getKeySet
Gets the keys of all managed storages.- Returns:
- an unmodifiable set of the context keys
-