Package org.apache.myfaces.cdi.util
Class ContextualStorage
- java.lang.Object
- 
- org.apache.myfaces.cdi.util.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
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected booleanactivatedprotected jakarta.enterprise.inject.spi.BeanManagerbeanManagerprotected Map<String,Object>beanNameToKeyMappingprotected booleanconcurrentprotected Map<Object,ContextualInstanceInfo<?>>contextualInstancesprotected booleanpassivating
 - 
Constructor SummaryConstructors Constructor Description ContextualStorage()ContextualStorage(jakarta.enterprise.inject.spi.BeanManager beanManager, boolean concurrent, boolean passivating)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()voidclear()<T> TcreateContextualInstance(jakarta.enterprise.context.spi.Contextual<T> bean, jakarta.enterprise.context.spi.CreationalContext<T> creationalContext)voiddeactivate()jakarta.enterprise.context.spi.Contextual<?>getBean(Object beanKey)Restores the bean from its beanKey.<T> ObjectgetBeanKey(jakarta.enterprise.context.spi.Contextual<T> bean)If the context is a passivating scope then we return the passivationId of the bean.Map<String,Object>getBeanNameToKeyMapping()Map<Object,ContextualInstanceInfo<?>>getStorage()booleanisActivated()booleanisConcurrent()
 
- 
- 
- 
Field Detail- 
contextualInstancesprotected Map<Object,ContextualInstanceInfo<?>> contextualInstances 
 - 
beanManagerprotected jakarta.enterprise.inject.spi.BeanManager beanManager 
 - 
concurrentprotected boolean concurrent 
 - 
passivatingprotected boolean passivating 
 - 
activatedprotected transient volatile boolean activated 
 
- 
 - 
Constructor Detail- 
ContextualStoragepublic ContextualStorage() 
 - 
ContextualStoragepublic ContextualStorage(jakarta.enterprise.inject.spi.BeanManager beanManager, boolean concurrent, boolean passivating)- Parameters:
- beanManager- is needed for serialisation
- concurrent- whether the ContextualStorage might get accessed concurrently by different threads
- passivating- whether the served scope is a passivating scope
 
 
- 
 - 
Method Detail- 
getStoragepublic Map<Object,ContextualInstanceInfo<?>> getStorage() - Returns:
- the underlying storage map.
 
 - 
clearpublic void clear() 
 - 
isConcurrentpublic boolean isConcurrent() - Returns:
- whether the ContextualStorage might get accessed concurrently by different threads.
 
 - 
createContextualInstancepublic <T> T createContextualInstance(jakarta.enterprise.context.spi.Contextual<T> bean, jakarta.enterprise.context.spi.CreationalContext<T> creationalContext)- Type Parameters:
- T-
- Parameters:
- bean-
- creationalContext-
- Returns:
 
 - 
getBeanKeypublic <T> Object getBeanKey(jakarta.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, this is mainly for Quarkus.- Parameters:
- bean-
- Returns:
- the key to use in the context map
 
 - 
getBeanpublic jakarta.enterprise.context.spi.Contextual<?> getBean(Object beanKey) Restores the bean from its beanKey. It returns null if the beanKey does not belong to a bean or is not Contextual.
 - 
isActivatedpublic boolean isActivated() 
 - 
activatepublic void activate() 
 - 
deactivatepublic void deactivate() 
 
- 
 
-