java.lang.Object
org.omnifaces.cdi.BeanStorage
- All Implemented Interfaces:
Serializable
CDI bean storage. This class is theoretically reusable for multiple CDI scopes. It's currently however only used by
the OmniFaces CDI view scope.
- Since:
- 1.6
- Author:
- Radu Creanga <rdcrng@gmail.com>, Bauke Scholtz
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBeanStorage(int initialCapacity) Construct a new CDI bean storage with the given initial capacity of the map holding all beans. -
Method Summary
Modifier and TypeMethodDescriptionvoidDestroy all beans managed so far.<T> TgetBean(Contextual<T> type) Returns the bean associated with the given context, ornullif there is none.<T> TgetBean(Contextual<T> type, CreationalContext<T> context) Returns the bean associated with the given context, or if there is none, then create one with the given creational context.
-
Constructor Details
-
BeanStorage
public BeanStorage(int initialCapacity) Construct a new CDI bean storage with the given initial capacity of the map holding all beans.- Parameters:
initialCapacity- The initial capacity of the map holding all beans.
-
-
Method Details
-
getBean
Returns the bean associated with the given context, or if there is none, then create one with the given creational context.- Type Parameters:
T- The generic bean type.- Parameters:
type- The contextual type of the CDI managed bean.- Returns:
- The bean associated with given context and creational context.
- Since:
- 4.5
-
getBean
Returns the bean associated with the given context, ornullif there is none.- Type Parameters:
T- The generic bean type.- Parameters:
type- The contextual type of the CDI managed bean.- Returns:
- The bean associated with the given context, or
nullif there is none.
-
destroyBeans
public void destroyBeans()Destroy all beans managed so far.
-