miercuri, 4 februarie 2015

OmniFaces utilities (2.0)] Get the CDI managed bean instance (actual) of the given bean class (decide to create one if it doesn't exist)


[OmniFaces utilities] The getInstance() returns the CDI managed bean instance (actual) of the given bean class and creates one if one doesn't exist and create argument is true, otherwise don't create one and return null if there's no current instance.

Method:
Usage:

import org.omnifaces.util.Beans;
...
// in/out CDI bean TestBean
// if the second parameter is false and there's no current instance, then it will return null
TestBean testBean = Beans.getInstance(TestBean.class, true); 

Niciun comentariu:

Trimiteți un comentariu