- 

Available since OmniFaces 1.6.1

Collection of utility methods for the CDI API that are mainly shortcuts for obtaining stuff from the BeanManager.

Usage

Here are 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);

For a full list, check the method summary.

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" Faces utility library, feel free to post a feature request.

Documentation & Sources