Interface BeanStore
-
- All Superinterfaces:
Iterable<org.jboss.weld.serialization.spi.BeanIdentifier>
- All Known Subinterfaces:
BoundBeanStore
- All Known Implementing Classes:
AbstractMapBackedBeanStore,AttributeBeanStore,ConcurrentHashMapBeanStore,HashMapBeanStore,MapBeanStore,SessionMapBeanStore
public interface BeanStore extends Iterable<org.jboss.weld.serialization.spi.BeanIdentifier>
AMaplike store of contextual instances, used to back the Weld built in contexts.- Author:
- Nicklas Karlsson
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clears the store of contextual instancesbooleancontains(org.jboss.weld.serialization.spi.BeanIdentifier id)Check if the store contains an instance<T> ContextualInstance<T>get(org.jboss.weld.serialization.spi.BeanIdentifier id)Gets an instance of a contextual from the storeIterator<org.jboss.weld.serialization.spi.BeanIdentifier>iterator()LockedBeanlock(org.jboss.weld.serialization.spi.BeanIdentifier id)Gets a creation lock for the given bean id.<T> voidput(org.jboss.weld.serialization.spi.BeanIdentifier id, ContextualInstance<T> contextualInstance)Adds a bean instance to the storage<T> ContextualInstance<T>remove(org.jboss.weld.serialization.spi.BeanIdentifier id)Removes a bean instance identified by the given id.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
get
<T> ContextualInstance<T> get(org.jboss.weld.serialization.spi.BeanIdentifier id)
Gets an instance of a contextual from the store- Parameters:
id- The id of the contextual to return- Returns:
- The instance or null if not found
-
contains
boolean contains(org.jboss.weld.serialization.spi.BeanIdentifier id)
Check if the store contains an instance- Parameters:
id- the id of the instance to check for- Returns:
- true if the instance is present, otherwise false
-
clear
void clear()
Clears the store of contextual instances
-
iterator
Iterator<org.jboss.weld.serialization.spi.BeanIdentifier> iterator()
-
put
<T> void put(org.jboss.weld.serialization.spi.BeanIdentifier id, ContextualInstance<T> contextualInstance)Adds a bean instance to the storage- Parameters:
contextualInstance- the contextual instance
-
lock
LockedBean lock(org.jboss.weld.serialization.spi.BeanIdentifier id)
Gets a creation lock for the given bean id.- Parameters:
id- The bean id- Returns:
- A handle that must be used to unlock the bean
-
remove
<T> ContextualInstance<T> remove(org.jboss.weld.serialization.spi.BeanIdentifier id)
Removes a bean instance identified by the given id.- Parameters:
id- The bean id- Returns:
- the removed bean instance of null if there was no bean instance before
-
-