Package org.jboss.weld.serialization.spi
Interface ContextualStore
- All Superinterfaces:
Service
Application wide contextual identifier service which allows a serializable reference to a contextual to be obtained, and the contextual to be returned for a given id.
If the contextual implements PassivationCapable, the id will be obtained from it, in which case the Contextual can be activated in any container. If not, the Contextual can only be activated in this container.
Note that this allows a Bean object to be loaded regardless of the bean's accessiblity from the current module, and should not be abused as a way to ignore accessibility rules enforced during resolution.
- Author:
- Pete Muir, Marius Bogoevici
-
Method Summary
Modifier and TypeMethodDescription<C extends jakarta.enterprise.context.spi.Contextual<I>,I>
CgetContextual(String id) Given a particular id, return the correct contextual.<C extends jakarta.enterprise.context.spi.Contextual<I>,I>
CgetContextual(BeanIdentifier identifier) Given a particular bean identifier, return the correct contextual.<C extends jakarta.enterprise.context.spi.Contextual<I>,I>
SerializableContextual<C,I> getSerializableContextual(jakarta.enterprise.context.spi.Contextual<I> contextual) Returns aSerializableContextualthat corresponds to the givenContextual<C extends jakarta.enterprise.context.spi.Contextual<I>,I>
SerializableContextualInstance<C,I> getSerializableContextualInstance(jakarta.enterprise.context.spi.Contextual<I> contextual, I instance, jakarta.enterprise.context.spi.CreationalContext<I> creationalContext) Returns aSerializableContextualInstancethat corresponds to the given instance andContextualputIfAbsent(jakarta.enterprise.context.spi.Contextual<?> contextual) Add a contextual (if not already present) to the store, and return it's id.
-
Method Details
-
getContextual
Given a particular id, return the correct contextual. For contextuals which aren't passivation capable, the contextual can't be found in another container, and null will be returned.- Type Parameters:
C- the contextualI- the type of the contextual- Parameters:
id- An identifier for the contextual- Returns:
- the contextual
-
getContextual
<C extends jakarta.enterprise.context.spi.Contextual<I>,I> C getContextual(BeanIdentifier identifier) Given a particular bean identifier, return the correct contextual. For contextuals which aren't passivation capable, the contextual can't be found in another container, and null will be returned.- Type Parameters:
C- the contextualI- the type of the contextual- Parameters:
identifier- An identifier for the contextual- Returns:
- the contextual
-
putIfAbsent
Add a contextual (if not already present) to the store, and return it's id. If the contextual is passivation capable, it's id will be used, otherwise an id will be generated- Parameters:
contextual- the contexutal to add- Returns:
- the current id for the contextual
-
getSerializableContextual
<C extends jakarta.enterprise.context.spi.Contextual<I>,I> SerializableContextual<C,I> getSerializableContextual(jakarta.enterprise.context.spi.Contextual<I> contextual) Returns aSerializableContextualthat corresponds to the givenContextual- Type Parameters:
C- the contextualI- the type of the contextual- Parameters:
contextual- the contextual for which the serializable contextual is created- Returns:
- a serializable contextual
-
getSerializableContextualInstance
<C extends jakarta.enterprise.context.spi.Contextual<I>,I> SerializableContextualInstance<C,I> getSerializableContextualInstance(jakarta.enterprise.context.spi.Contextual<I> contextual, I instance, jakarta.enterprise.context.spi.CreationalContext<I> creationalContext) Returns aSerializableContextualInstancethat corresponds to the given instance andContextual- Type Parameters:
C- the contextualI- the type of the contextual- Parameters:
contextual- the contextual for which the serializable contextual instance is returnedinstance- the instancecreationalContext- the creational context of the instance- Returns:
- the serializable contextual instance
-