Package com.vaadin.quarkus.context
Class ContextualStorage
- java.lang.Object
-
- com.vaadin.quarkus.context.ContextualStorage
-
- All Implemented Interfaces:
Serializable
public class ContextualStorage extends Object implements Serializable
This Storage holds all information needed for storing Contextual Instances in a Context. It also addresses Serialisation in case of passivating scopes.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ContextualStorage(boolean concurrent)Creates a new instance of storage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TcreateContextualInstance(javax.enterprise.context.spi.Contextual<T> bean, javax.enterprise.context.spi.CreationalContext<T> creationalContext)javax.enterprise.context.spi.Contextual<?>getBean(Object beanKey)Restores the Bean from its beanKey.<T> ObjectgetBeanKey(javax.enterprise.context.spi.Contextual<T> bean)If the context is a passivating scope then we return the passivationId of the Bean.Map<Object,ContextualInstanceInfo<?>>getStorage()booleanisConcurrent()
-
-
-
Method Detail
-
getStorage
public Map<Object,ContextualInstanceInfo<?>> getStorage()
- Returns:
- the underlying storage map.
-
isConcurrent
public boolean isConcurrent()
- Returns:
- whether the ContextualStorage might get accessed concurrently by different threads.
-
createContextualInstance
public <T> T createContextualInstance(javax.enterprise.context.spi.Contextual<T> bean, javax.enterprise.context.spi.CreationalContext<T> creationalContext)- Type Parameters:
T- contextual instance type- Parameters:
bean- the contextual typecreationalContext- a context- Returns:
- a created contextual instance
-
getBeanKey
public <T> Object getBeanKey(javax.enterprise.context.spi.Contextual<T> bean)
If the context is a passivating scope then we return the passivationId of the Bean. Otherwise we use the Bean directly.- Type Parameters:
T- bean type- Parameters:
bean- the contextual type- Returns:
- the key to use in the context map
-
getBean
public javax.enterprise.context.spi.Contextual<?> getBean(Object beanKey)
Restores the Bean from its beanKey.- Parameters:
beanKey- a bean key- Returns:
- the contextual type
- See Also:
getBeanKey(javax.enterprise.context.spi.Contextual)
-
-