- cdi
- components
- contexts
- converters
- el
- eventlisteners
- exceptionhandlers
- facesviews
- filters
- functions
- managedbeans
- push
- resourcehandlers
- search
- servlets
- taghandlers
- utils
- validators
- viewhandlers
- - Ajax
- Beans
- BeansLocal
- Components
- Events
- Exceptions
- Faces
- FacesConfigXml
- FacesLocal
- JNDI
- JNDIObjectLocator
- Messages
- Servlets
- WebXml
- cdi
- components
- contexts
- converters
- el
- eventlisteners
- exceptionhandlers
- facesviews
- filters
- functions
- managedbeans
- push
- resourcehandlers
- search
- servlets
- taghandlers
- utils
- validators
- viewhandlers
- Ajax
- Beans
- BeansLocal
- Components
- Events
- Exceptions
- Faces
- FacesConfigXml
- FacesLocal
- JNDI
- JNDIObjectLocator
- Messages
- Servlets
- WebXml
Collection of utility methods for the CDI API that are mainly shortcuts for obtaining stuff from the BeanManager
.
Usage
Some examples:
// Get the CDI managed bean reference (proxy) of the given bean class.
SomeBean someBean = Beans.getReference(SomeBean.class);
// Get the CDI managed bean instance (actual) of the given bean class.
SomeBean someBean = Beans.getInstance(SomeBean.class);
// Check if CDI session scope is active in current context.
Beans.isActive(SessionScope.class);
// Get all currently active CDI managed bean instances in the session scope.
Map<Object, String> activeSessionScopedBeans = Beans.getActiveInstances(SessionScope.class);
// Destroy any currently active CDI managed bean instance of given bean class.
Beans.destroy(SomeBean.class);
// Fire a CDI event.
Beans.fireEvent(someEvent);
Feature request
If you know more useful methods/functions which you think should be added to this OmniFaces utility class so that everyone can benefit from a "standard" JSF utility library, feel free to post a feature request.
Documentation & Sources