sâmbătă, 7 martie 2015

[OmniFaces utilities (2.1)] Get all active CDI managed bean instances in the given CDI managed bean scope


[OmniFaces utilities] The getActiveInstances() method returns all active CDI managed bean instances in the given CDI managed bean scope. The map key represents the active CDI managed bean instance and the map value represents the CDI managed bean name, if any. - this utility method exist in OmniFaces 2.0, but it was fixed to work as expected in OmniFaces 2.1 SNAPSHOT.

Method:
Usage:

import javax.enterprise.context.RequestScoped;
...
Map<Object, String> activeRequestScopedBeans = Beans.getActiveInstances(RequestScoped.class);

import javax.enterprise.context.SessionScoped;
...
Map<Object, String> activeSessionScopedBeans = Beans.getActiveInstances(SessionScoped.class);

Niciun comentariu:

Trimiteți un comentariu