Package com.vaadin.quarkus.context
Class UIScopedContext.ContextualStorageManager
java.lang.Object
com.vaadin.quarkus.context.UIScopedContext.ContextualStorageManager
- All Implemented Interfaces:
Serializable
- Enclosing class:
UIScopedContext
Manages the contextual storages of UI scoped beans, one for each UI.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a storage manager that relies on the session lock instead of locking on its own. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDestroys the contextual storage associated with the given context key.protected voidDestroys all existing contextual storages.getContextualStorage(boolean createIfNotExist) Gets the contextual storage of the current UI.protected ContextualStoragegetContextualStorage(Integer key, boolean createIfNotExist) Gets theContextualStorageassociated with the given contextkey, possibly creating a new instance, if requested and not already existing.Gets context keys of all registered contextual storages.protected ContextualStoragenewContextualStorage(Integer uiId) Creates a newContextualStoragefor the given context key.protected voidChanges the context key for a contextual storage.
-
Constructor Details
-
ContextualStorageManager
public ContextualStorageManager()Creates a storage manager that relies on the session lock instead of locking on its own.
-
-
Method Details
-
getContextualStorage
Gets the contextual storage of the current UI.- Parameters:
createIfNotExist- whether to create the storage if it does not exist yet- Returns:
- the storage, or
nullif it does not exist andcreateIfNotExistisfalse
-
newContextualStorage
Creates a newContextualStoragefor the given context key.- Parameters:
uiId- the context key- Returns:
- a new
ContextualStorageinstance.
-
getContextualStorage
Gets theContextualStorageassociated with the given contextkey, possibly creating a new instance, if requested and not already existing.- Parameters:
key- context keycreateIfNotExist- whether a ContextualStorage shall get created if it doesn't yet exist.- Returns:
- a
ContextualStorageinstance.
-
relocate
Changes the context key for a contextual storage.- Parameters:
from- the contextual storage context keyto- the new context for the contextual storage
-
destroyAll
@PreDestroy protected void destroyAll()Destroys all existing contextual storages. -
destroy
Destroys the contextual storage associated with the given context key.- Parameters:
key- the context key
-
getKeySet
Gets context keys of all registered contextual storages.- Returns:
- immutable set of context keys.
-